2014-08-20 21:31:57

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 1/6] staging: vt6655: device.h dead code remove bCCK

bCCK is always set to true, the only place it is used is in
BBvCalculateParameter which nots the value to false.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/baseband.c | 6 ------
drivers/staging/vt6655/device.h | 1 -
drivers/staging/vt6655/device_main.c | 2 --
drivers/staging/vt6655/wmgr.c | 1 -
4 files changed, 10 deletions(-)

diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c
index c1025ff..7dd866e 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -1837,7 +1837,6 @@ BBvCalculateParameter(
unsigned int cbTmp;
bool bExtBit;
unsigned char byPreambleType = pDevice->byPreambleType;
- bool bCCK = pDevice->bCCK;

cbBitCount = cbFrameLength * 8;
bExtBit = false;
@@ -1857,8 +1856,6 @@ BBvCalculateParameter(
break;

case RATE_5M:
- if (!bCCK)
- cbBitCount++;
cbUsCount = (cbBitCount * 10) / 55;
cbTmp = (cbUsCount * 55) / 10;
if (cbTmp != cbBitCount)
@@ -1870,9 +1867,6 @@ BBvCalculateParameter(
break;

case RATE_11M:
-
- if (!bCCK)
- cbBitCount++;
cbUsCount = cbBitCount / 11;
cbTmp = cbUsCount * 11;
if (cbTmp != cbBitCount) {
diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index 1abad5d..2434a37 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -488,7 +488,6 @@ struct vnt_private {

unsigned long dwMaxReceiveLifetime; // dot11MaxReceiveLifetime

- bool bCCK;
bool bEncryptionEnable;
bool bLongHeader;
bool bShortSlotTime;
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 3a2fd29..1a94d4f 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -469,8 +469,6 @@ static void device_init_registers(struct vnt_private *pDevice)
/* Do MACbSoftwareReset in MACvInitialize */
MACbSoftwareReset(pDevice->PortOffset);

- /* force CCK */
- pDevice->bCCK = true;
pDevice->bAES = false;

/* Only used in 11g type, sync with ERP IE */
diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c
index c3de107..ba273c7 100644
--- a/drivers/staging/vt6655/wmgr.c
+++ b/drivers/staging/vt6655/wmgr.c
@@ -2663,7 +2663,6 @@ s_vMgrSynchBSS(
}

// Init the BSS informations
- pDevice->bCCK = true;
pDevice->bProtectMode = false;
MACvDisableProtectMD(pDevice->PortOffset);
pDevice->bBarkerPreambleMd = false;
--
1.9.1



2014-08-20 21:32:01

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 3/6] staging: vt6655: baseband add new function vnt_get_phy_field

This is a replacement for BBvCalculateParameter for getting
the phy fields via struct vnt_phy_field

This is a direct copy from the vt6656 driver.

BBvCalculateParameter will removed later.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/baseband.c | 145 ++++++++++++++++++++++++++++++++++++--
drivers/staging/vt6655/baseband.h | 3 +
2 files changed, 142 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c
index 7dd866e..5842206 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -1810,17 +1810,150 @@ BBuGetFrameTime(
*
* Parameters:
* In:
- * pDevice - Device Structure
- * cbFrameLength - Tx Frame Length
- * wRate - Tx Rate
+ * priv - Device Structure
+ * frame_length - Tx Frame Length
+ * tx_rate - 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 vnt_get_phy_field(struct vnt_private *priv, u32 frame_length,
+ u16 tx_rate, u8 pkt_type, struct vnt_phy_field *phy)
+{
+ u32 bit_count;
+ u32 count = 0;
+ u32 tmp;
+ int ext_bit;
+ u8 preamble_type = priv->byPreambleType;
+
+ bit_count = frame_length * 8;
+ ext_bit = false;
+
+ switch (tx_rate) {
+ case RATE_1M:
+ count = bit_count;
+
+ phy->signal = 0x00;
+
+ break;
+ case RATE_2M:
+ count = bit_count / 2;
+
+ if (preamble_type == 1)
+ phy->signal = 0x09;
+ else
+ phy->signal = 0x01;
+
+ break;
+ case RATE_5M:
+ count = (bit_count * 10) / 55;
+ tmp = (count * 55) / 10;
+
+ if (tmp != bit_count)
+ count++;
+
+ if (preamble_type == 1)
+ phy->signal = 0x0a;
+ else
+ phy->signal = 0x02;
+
+ break;
+ case RATE_11M:
+ count = bit_count / 11;
+ tmp = count * 11;
+
+ if (tmp != bit_count) {
+ count++;
+
+ if ((bit_count - tmp) <= 3)
+ ext_bit = true;
+ }
+
+ if (preamble_type == 1)
+ phy->signal = 0x0b;
+ else
+ phy->signal = 0x03;
+
+ break;
+ case RATE_6M:
+ if (pkt_type == PK_TYPE_11A)
+ phy->signal = 0x9b;
+ else
+ phy->signal = 0x8b;
+
+ break;
+ case RATE_9M:
+ if (pkt_type == PK_TYPE_11A)
+ phy->signal = 0x9f;
+ else
+ phy->signal = 0x8f;
+
+ break;
+ case RATE_12M:
+ if (pkt_type == PK_TYPE_11A)
+ phy->signal = 0x9a;
+ else
+ phy->signal = 0x8a;
+
+ break;
+ case RATE_18M:
+ if (pkt_type == PK_TYPE_11A)
+ phy->signal = 0x9e;
+ else
+ phy->signal = 0x8e;
+
+ break;
+ case RATE_24M:
+ if (pkt_type == PK_TYPE_11A)
+ phy->signal = 0x99;
+ else
+ phy->signal = 0x89;
+
+ break;
+ case RATE_36M:
+ if (pkt_type == PK_TYPE_11A)
+ phy->signal = 0x9d;
+ else
+ phy->signal = 0x8d;
+
+ break;
+ case RATE_48M:
+ if (pkt_type == PK_TYPE_11A)
+ phy->signal = 0x98;
+ else
+ phy->signal = 0x88;
+
+ break;
+ case RATE_54M:
+ if (pkt_type == PK_TYPE_11A)
+ phy->signal = 0x9c;
+ else
+ phy->signal = 0x8c;
+ break;
+ default:
+ if (pkt_type == PK_TYPE_11A)
+ phy->signal = 0x9c;
+ else
+ phy->signal = 0x8c;
+ break;
+ }
+
+ if (pkt_type == PK_TYPE_11B) {
+ phy->service = 0x00;
+ if (ext_bit)
+ phy->service |= 0x80;
+ phy->len = cpu_to_le16((u16)count);
+ } else {
+ phy->service = 0x00;
+ phy->len = cpu_to_le16((u16)frame_length);
+ }
+}
+
void
BBvCalculateParameter(
struct vnt_private *pDevice,
diff --git a/drivers/staging/vt6655/baseband.h b/drivers/staging/vt6655/baseband.h
index 6b43885..049e6b4 100644
--- a/drivers/staging/vt6655/baseband.h
+++ b/drivers/staging/vt6655/baseband.h
@@ -87,6 +87,9 @@ BBvCalculateParameter(
unsigned char *pbyPhySgn
);

+void vnt_get_phy_field(struct vnt_private *, u32 frame_length,
+ u16 tx_rate, u8 pkt_type, struct vnt_phy_field *);
+
bool BBbReadEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char *pbyData);
bool BBbWriteEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byData);

--
1.9.1


2014-08-20 21:32:06

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 6/6] staging: vt6655: Remove BBvCalculateParameter and its data members

Remove data members bySignalField*, byServiceField*, wTransmitLength*
from structures in desc.h

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/baseband.c | 143 --------------------------------------
drivers/staging/vt6655/baseband.h | 11 ---
drivers/staging/vt6655/desc.h | 42 -----------
3 files changed, 196 deletions(-)

diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c
index 5842206..40710bb 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -1954,149 +1954,6 @@ void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length,
}
}

-void
-BBvCalculateParameter(
- struct vnt_private *pDevice,
- unsigned int cbFrameLength,
- unsigned short wRate,
- unsigned char byPacketType,
- unsigned short *pwPhyLen,
- unsigned char *pbyPhySrv,
- unsigned char *pbyPhySgn
-)
-{
- unsigned int cbBitCount;
- unsigned int cbUsCount = 0;
- unsigned int cbTmp;
- bool bExtBit;
- unsigned char byPreambleType = pDevice->byPreambleType;
-
- cbBitCount = cbFrameLength * 8;
- bExtBit = false;
-
- switch (wRate) {
- case RATE_1M:
- cbUsCount = cbBitCount;
- *pbyPhySgn = 0x00;
- break;
-
- case RATE_2M:
- cbUsCount = cbBitCount / 2;
- if (byPreambleType == 1)
- *pbyPhySgn = 0x09;
- else /* long preamble */
- *pbyPhySgn = 0x01;
- break;
-
- case RATE_5M:
- cbUsCount = (cbBitCount * 10) / 55;
- cbTmp = (cbUsCount * 55) / 10;
- if (cbTmp != cbBitCount)
- cbUsCount++;
- if (byPreambleType == 1)
- *pbyPhySgn = 0x0a;
- else /* long preamble */
- *pbyPhySgn = 0x02;
- break;
-
- case RATE_11M:
- cbUsCount = cbBitCount / 11;
- cbTmp = cbUsCount * 11;
- if (cbTmp != cbBitCount) {
- cbUsCount++;
- if ((cbBitCount - cbTmp) <= 3)
- bExtBit = true;
- }
- if (byPreambleType == 1)
- *pbyPhySgn = 0x0b;
- else /* long preamble */
- *pbyPhySgn = 0x03;
- break;
-
- case RATE_6M:
- if (byPacketType == PK_TYPE_11A) { /*11a, 5GHZ */
- *pbyPhySgn = 0x9B; /* 1001 1011 */
- } else {/* 11g, 2.4GHZ */
- *pbyPhySgn = 0x8B; /* 1000 1011 */
- }
- break;
-
- case RATE_9M:
- if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */
- *pbyPhySgn = 0x9F; /* 1001 1111 */
- } else {/* 11g, 2.4GHZ */
- *pbyPhySgn = 0x8F; /* 1000 1111 */
- }
- break;
-
- case RATE_12M:
- if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */
- *pbyPhySgn = 0x9A; /* 1001 1010 */
- } else {/* 11g, 2.4GHZ */
- *pbyPhySgn = 0x8A; /* 1000 1010 */
- }
- break;
-
- case RATE_18M:
- if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */
- *pbyPhySgn = 0x9E; /* 1001 1110 */
- } else {/* 11g, 2.4GHZ */
- *pbyPhySgn = 0x8E; /* 1000 1110 */
- }
- break;
-
- case RATE_24M:
- if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */
- *pbyPhySgn = 0x99; /* 1001 1001 */
- } else {/* 11g, 2.4GHZ */
- *pbyPhySgn = 0x89; /* 1000 1001 */
- }
- break;
-
- case RATE_36M:
- if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */
- *pbyPhySgn = 0x9D; /* 1001 1101 */
- } else {/* 11g, 2.4GHZ */
- *pbyPhySgn = 0x8D; /* 1000 1101 */
- }
- break;
-
- case RATE_48M:
- if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */
- *pbyPhySgn = 0x98; /* 1001 1000 */
- } else {/* 11g, 2.4GHZ */
- *pbyPhySgn = 0x88; /* 1000 1000 */
- }
- break;
-
- case RATE_54M:
- if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */
- *pbyPhySgn = 0x9C; /* 1001 1100 */
- } else {/* 11g, 2.4GHZ */
- *pbyPhySgn = 0x8C; /* 1000 1100 */
- }
- break;
-
- default:
- if (byPacketType == PK_TYPE_11A) {/* 11a, 5GHZ */
- *pbyPhySgn = 0x9C; /* 1001 1100 */
- } else {/* 11g, 2.4GHZ */
- *pbyPhySgn = 0x8C; /* 1000 1100 */
- }
- break;
- }
-
- if (byPacketType == PK_TYPE_11B) {
- *pbyPhySrv = 0x00;
- if (bExtBit)
- *pbyPhySrv = *pbyPhySrv | 0x80;
- *pwPhyLen = (unsigned short)cbUsCount;
- } else {
- *pbyPhySrv = 0x00;
- *pwPhyLen = (unsigned short)cbFrameLength;
- }
-}
-
/*
* Description: Read a byte from BASEBAND, by embedded programming
*
diff --git a/drivers/staging/vt6655/baseband.h b/drivers/staging/vt6655/baseband.h
index 049e6b4..78620d3 100644
--- a/drivers/staging/vt6655/baseband.h
+++ b/drivers/staging/vt6655/baseband.h
@@ -76,17 +76,6 @@ BBuGetFrameTime(
unsigned short wRate
);

-void
-BBvCalculateParameter(
- struct vnt_private *pDevice,
- unsigned int cbFrameLength,
- unsigned short wRate,
- unsigned char byPacketType,
- unsigned short *pwPhyLen,
- unsigned char *pbyPhySrv,
- unsigned char *pbyPhySgn
-);
-
void vnt_get_phy_field(struct vnt_private *, u32 frame_length,
u16 tx_rate, u8 pkt_type, struct vnt_phy_field *);

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 1842723..10bd564 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -393,12 +393,6 @@ union vnt_phy_field_swap {
typedef struct tagSRTS_g {
struct vnt_phy_field b;
struct vnt_phy_field a;
- unsigned char bySignalField_b;
- unsigned char byServiceField_b;
- unsigned short wTransmitLength_b;
- unsigned char bySignalField_a;
- unsigned char byServiceField_a;
- unsigned short wTransmitLength_a;
unsigned short wDuration_ba;
unsigned short wDuration_aa;
unsigned short wDuration_bb;
@@ -411,12 +405,6 @@ typedef const SRTS_g *PCSRTS_g;
typedef struct tagSRTS_g_FB {
struct vnt_phy_field b;
struct vnt_phy_field a;
- unsigned char bySignalField_b;
- unsigned char byServiceField_b;
- unsigned short wTransmitLength_b;
- unsigned char bySignalField_a;
- unsigned char byServiceField_a;
- unsigned short wTransmitLength_a;
unsigned short wDuration_ba;
unsigned short wDuration_aa;
unsigned short wDuration_bb;
@@ -432,9 +420,6 @@ typedef const SRTS_g_FB *PCSRTS_g_FB;

typedef struct tagSRTS_ab {
struct vnt_phy_field ab;
- unsigned char bySignalField;
- unsigned char byServiceField;
- unsigned short wTransmitLength;
unsigned short wDuration;
unsigned short wReserved;
SRTSData Data;
@@ -444,9 +429,6 @@ typedef const SRTS_ab *PCSRTS_ab;

typedef struct tagSRTS_a_FB {
struct vnt_phy_field a;
- unsigned char bySignalField;
- unsigned char byServiceField;
- unsigned short wTransmitLength;
unsigned short wDuration;
unsigned short wReserved;
unsigned short wRTSDuration_f0;
@@ -469,9 +451,6 @@ SCTSData, *PSCTSData;

typedef struct tagSCTS {
struct vnt_phy_field b;
- unsigned char bySignalField_b;
- unsigned char byServiceField_b;
- unsigned short wTransmitLength_b;
unsigned short wDuration_ba;
unsigned short wReserved;
SCTSData Data;
@@ -481,9 +460,6 @@ typedef const SCTS *PCSCTS;

typedef struct tagSCTS_FB {
struct vnt_phy_field b;
- unsigned char bySignalField_b;
- unsigned char byServiceField_b;
- unsigned short wTransmitLength_b;
unsigned short wDuration_ba;
unsigned short wReserved;
unsigned short wCTSDuration_ba_f0;
@@ -520,12 +496,6 @@ typedef const STxShortBufHead *PCSTxShortBufHead;
typedef struct tagSTxDataHead_g {
struct vnt_phy_field b;
struct vnt_phy_field a;
- unsigned char bySignalField_b;
- unsigned char byServiceField_b;
- unsigned short wTransmitLength_b;
- unsigned char bySignalField_a;
- unsigned char byServiceField_a;
- unsigned short wTransmitLength_a;
unsigned short wDuration_b;
unsigned short wDuration_a;
unsigned short wTimeStampOff_b;
@@ -537,12 +507,6 @@ typedef const STxDataHead_g *PCSTxDataHead_g;
typedef struct tagSTxDataHead_g_FB {
struct vnt_phy_field b;
struct vnt_phy_field a;
- unsigned char bySignalField_b;
- unsigned char byServiceField_b;
- unsigned short wTransmitLength_b;
- unsigned char bySignalField_a;
- unsigned char byServiceField_a;
- unsigned short wTransmitLength_a;
unsigned short wDuration_b;
unsigned short wDuration_a;
unsigned short wDuration_a_f0;
@@ -555,9 +519,6 @@ typedef const STxDataHead_g_FB *PCSTxDataHead_g_FB;

typedef struct tagSTxDataHead_ab {
struct vnt_phy_field ab;
- unsigned char bySignalField;
- unsigned char byServiceField;
- unsigned short wTransmitLength;
unsigned short wDuration;
unsigned short wTimeStampOff;
} __attribute__ ((__packed__))
@@ -566,9 +527,6 @@ typedef const STxDataHead_ab *PCSTxDataHead_ab;

typedef struct tagSTxDataHead_a_FB {
struct vnt_phy_field a;
- unsigned char bySignalField;
- unsigned char byServiceField;
- unsigned short wTransmitLength;
unsigned short wDuration;
unsigned short wTimeStampOff;
unsigned short wDuration_f0;
--
1.9.1


2014-08-20 21:32:04

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 5/6] staging: vt6655: card.c change BBvCalculateParameter to vnt_get_phy_field

Using vnt_get_phy_field means the values are not in the
correct write order the lower word and the upper word need
to be swapped over for an u32 write out.

Rather create another data variable to manipulate this structure.
Create a new union vnt_phy_field_swap with struct vnt_phy_field,
the u16 word swap and the u32 write out.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/card.c | 154 +++++++++++++++++++-----------------------
drivers/staging/vt6655/desc.h | 6 ++
2 files changed, 76 insertions(+), 84 deletions(-)

diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 9807374..c4ed8d5 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -225,57 +225,51 @@ void
s_vSetRSPINF(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType,
void *pvSupportRateIEs, void *pvExtSupportRateIEs)
{
- unsigned char byServ = 0, bySignal = 0; // For CCK
- unsigned short wLen = 0;
+ union vnt_phy_field_swap phy;
unsigned char byTxRate = 0, byRsvTime = 0; // For OFDM

//Set to Page1
MACvSelectPage1(pDevice->PortOffset);

- //RSPINF_b_1
- BBvCalculateParameter(pDevice,
- 14,
- VNTWIFIbyGetACKTxRate(RATE_1M, pvSupportRateIEs, pvExtSupportRateIEs),
- PK_TYPE_11B,
- &wLen,
- &byServ,
- &bySignal
-);
+ /* RSPINF_b_1 */
+ vnt_get_phy_field(pDevice,
+ 14,
+ VNTWIFIbyGetACKTxRate(RATE_1M, pvSupportRateIEs, pvExtSupportRateIEs),
+ PK_TYPE_11B,
+ &phy.field_read);

- VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_1, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
- ///RSPINF_b_2
- BBvCalculateParameter(pDevice,
- 14,
- VNTWIFIbyGetACKTxRate(RATE_2M, pvSupportRateIEs, pvExtSupportRateIEs),
- PK_TYPE_11B,
- &wLen,
- &byServ,
- &bySignal
-);
+ /* swap over to get correct write order */
+ swap(phy.swap[0], phy.swap[1]);

- VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_2, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
- //RSPINF_b_5
- BBvCalculateParameter(pDevice,
- 14,
- VNTWIFIbyGetACKTxRate(RATE_5M, pvSupportRateIEs, pvExtSupportRateIEs),
- PK_TYPE_11B,
- &wLen,
- &byServ,
- &bySignal
-);
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_1, phy.field_write);

- VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_5, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
- //RSPINF_b_11
- BBvCalculateParameter(pDevice,
- 14,
- VNTWIFIbyGetACKTxRate(RATE_11M, pvSupportRateIEs, pvExtSupportRateIEs),
- PK_TYPE_11B,
- &wLen,
- &byServ,
- &bySignal
-);
+ /* RSPINF_b_2 */
+ vnt_get_phy_field(pDevice, 14,
+ VNTWIFIbyGetACKTxRate(RATE_2M, pvSupportRateIEs, pvExtSupportRateIEs),
+ PK_TYPE_11B, &phy.field_read);
+
+ swap(phy.swap[0], phy.swap[1]);
+
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_2, phy.field_write);
+
+ /* RSPINF_b_5 */
+ vnt_get_phy_field(pDevice, 14,
+ VNTWIFIbyGetACKTxRate(RATE_5M, pvSupportRateIEs, pvExtSupportRateIEs),
+ PK_TYPE_11B, &phy.field_read);
+
+ swap(phy.swap[0], phy.swap[1]);
+
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_5, phy.field_write);
+
+ /* RSPINF_b_11 */
+ vnt_get_phy_field(pDevice, 14,
+ VNTWIFIbyGetACKTxRate(RATE_11M, pvSupportRateIEs, pvExtSupportRateIEs),
+ PK_TYPE_11B, &phy.field_read);
+
+ swap(phy.swap[0], phy.swap[1]);
+
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_11, phy.field_write);

- VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_11, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
//RSPINF_a_6
s_vCalculateOFDMRParameter(RATE_6M,
ePHYType,
@@ -1592,57 +1586,49 @@ static unsigned short CARDwGetOFDMControlRate(struct vnt_private *pDevice,
*/
void CARDvSetRSPINF(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType)
{
- unsigned char byServ = 0x00, bySignal = 0x00; //For CCK
- unsigned short wLen = 0x0000;
+ union vnt_phy_field_swap phy;
unsigned char byTxRate, byRsvTime; //For OFDM

//Set to Page1
MACvSelectPage1(pDevice->PortOffset);

- //RSPINF_b_1
- BBvCalculateParameter(pDevice,
- 14,
- CARDwGetCCKControlRate((void *)pDevice, RATE_1M),
- PK_TYPE_11B,
- &wLen,
- &byServ,
- &bySignal
-);
+ /* RSPINF_b_1 */
+ vnt_get_phy_field(pDevice, 14,
+ CARDwGetCCKControlRate(pDevice, RATE_1M),
+ PK_TYPE_11B, &phy.field_read);

- VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_1, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
- ///RSPINF_b_2
- BBvCalculateParameter(pDevice,
- 14,
- CARDwGetCCKControlRate((void *)pDevice, RATE_2M),
- PK_TYPE_11B,
- &wLen,
- &byServ,
- &bySignal
-);
+ /* swap over to get correct write order */
+ swap(phy.swap[0], phy.swap[1]);

- VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_2, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
- //RSPINF_b_5
- BBvCalculateParameter(pDevice,
- 14,
- CARDwGetCCKControlRate((void *)pDevice, RATE_5M),
- PK_TYPE_11B,
- &wLen,
- &byServ,
- &bySignal
-);
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_1, phy.field_write);

- VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_5, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
- //RSPINF_b_11
- BBvCalculateParameter(pDevice,
- 14,
- CARDwGetCCKControlRate((void *)pDevice, RATE_11M),
- PK_TYPE_11B,
- &wLen,
- &byServ,
- &bySignal
-);
+ /* RSPINF_b_2 */
+ vnt_get_phy_field(pDevice, 14,
+ CARDwGetCCKControlRate(pDevice, RATE_2M),
+ PK_TYPE_11B, &phy.field_read);
+
+ swap(phy.swap[0], phy.swap[1]);
+
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_2, phy.field_write);
+
+ /* RSPINF_b_5 */
+ vnt_get_phy_field(pDevice, 14,
+ CARDwGetCCKControlRate(pDevice, RATE_5M),
+ PK_TYPE_11B, &phy.field_read);
+
+ swap(phy.swap[0], phy.swap[1]);
+
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_5, phy.field_write);
+
+ /* RSPINF_b_11 */
+ vnt_get_phy_field(pDevice, 14,
+ CARDwGetCCKControlRate(pDevice, RATE_11M),
+ PK_TYPE_11B, &phy.field_read);
+
+ swap(phy.swap[0], phy.swap[1]);
+
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_11, phy.field_write);

- VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_11, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
//RSPINF_a_6
s_vCalculateOFDMRParameter(RATE_6M,
ePHYType,
diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 1dd38f7..1842723 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -384,6 +384,12 @@ struct vnt_phy_field {
__le16 len;
} __packed;

+union vnt_phy_field_swap {
+ struct vnt_phy_field field_read;
+ u16 swap[2];
+ u32 field_write;
+};
+
typedef struct tagSRTS_g {
struct vnt_phy_field b;
struct vnt_phy_field a;
--
1.9.1


2014-08-20 21:31:59

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 2/6] staging: vt6655: add new stucture struct vnt_phy_field for rts/cts/data structures

This will replace bySignalField*, byServiceField* and wTransmitLength_b
members of these strutures, these are removed in the last patch.

The len member is of little endian type.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/desc.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index d3c9b0c..1dd38f7 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -377,7 +377,16 @@ typedef struct tagSRTSData {
SRTSData, *PSRTSData;
typedef const SRTSData *PCSRTSData;

+/* Length, Service, and Signal fields of Phy for Tx */
+struct vnt_phy_field {
+ u8 signal;
+ u8 service;
+ __le16 len;
+} __packed;
+
typedef struct tagSRTS_g {
+ struct vnt_phy_field b;
+ struct vnt_phy_field a;
unsigned char bySignalField_b;
unsigned char byServiceField_b;
unsigned short wTransmitLength_b;
@@ -394,6 +403,8 @@ SRTS_g, *PSRTS_g;
typedef const SRTS_g *PCSRTS_g;

typedef struct tagSRTS_g_FB {
+ struct vnt_phy_field b;
+ struct vnt_phy_field a;
unsigned char bySignalField_b;
unsigned char byServiceField_b;
unsigned short wTransmitLength_b;
@@ -414,6 +425,7 @@ SRTS_g_FB, *PSRTS_g_FB;
typedef const SRTS_g_FB *PCSRTS_g_FB;

typedef struct tagSRTS_ab {
+ struct vnt_phy_field ab;
unsigned char bySignalField;
unsigned char byServiceField;
unsigned short wTransmitLength;
@@ -425,6 +437,7 @@ SRTS_ab, *PSRTS_ab;
typedef const SRTS_ab *PCSRTS_ab;

typedef struct tagSRTS_a_FB {
+ struct vnt_phy_field a;
unsigned char bySignalField;
unsigned char byServiceField;
unsigned short wTransmitLength;
@@ -449,6 +462,7 @@ typedef struct tagSCTSData {
SCTSData, *PSCTSData;

typedef struct tagSCTS {
+ struct vnt_phy_field b;
unsigned char bySignalField_b;
unsigned char byServiceField_b;
unsigned short wTransmitLength_b;
@@ -460,6 +474,7 @@ SCTS, *PSCTS;
typedef const SCTS *PCSCTS;

typedef struct tagSCTS_FB {
+ struct vnt_phy_field b;
unsigned char bySignalField_b;
unsigned char byServiceField_b;
unsigned short wTransmitLength_b;
@@ -497,6 +512,8 @@ typedef const STxShortBufHead *PCSTxShortBufHead;
// Tx data header
//
typedef struct tagSTxDataHead_g {
+ struct vnt_phy_field b;
+ struct vnt_phy_field a;
unsigned char bySignalField_b;
unsigned char byServiceField_b;
unsigned short wTransmitLength_b;
@@ -512,6 +529,8 @@ STxDataHead_g, *PSTxDataHead_g;
typedef const STxDataHead_g *PCSTxDataHead_g;

typedef struct tagSTxDataHead_g_FB {
+ struct vnt_phy_field b;
+ struct vnt_phy_field a;
unsigned char bySignalField_b;
unsigned char byServiceField_b;
unsigned short wTransmitLength_b;
@@ -529,6 +548,7 @@ STxDataHead_g_FB, *PSTxDataHead_g_FB;
typedef const STxDataHead_g_FB *PCSTxDataHead_g_FB;

typedef struct tagSTxDataHead_ab {
+ struct vnt_phy_field ab;
unsigned char bySignalField;
unsigned char byServiceField;
unsigned short wTransmitLength;
@@ -539,6 +559,7 @@ STxDataHead_ab, *PSTxDataHead_ab;
typedef const STxDataHead_ab *PCSTxDataHead_ab;

typedef struct tagSTxDataHead_a_FB {
+ struct vnt_phy_field a;
unsigned char bySignalField;
unsigned char byServiceField;
unsigned short wTransmitLength;
--
1.9.1


2014-08-20 21:32:02

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 4/6] staging: vt6655: rxtx.c change BBvCalculateParameter to function vnt_get_phy_field

Removing wLen and pointing to correct member.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/rxtx.c | 151 ++++++++++++++++++------------------------
1 file changed, 65 insertions(+), 86 deletions(-)

diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 635e88c..04cf9e9 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -673,7 +673,6 @@ s_uFillDataHead(
unsigned short wCurrentRate
)
{
- unsigned short wLen = 0x0000;

if (pTxDataHead == NULL)
return 0;
@@ -682,15 +681,14 @@ s_uFillDataHead(
if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
if (byFBOption == AUTO_FB_NONE) {
PSTxDataHead_g pBuf = (PSTxDataHead_g)pTxDataHead;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_a), (unsigned char *)&(pBuf->bySignalField_a)
-);
- pBuf->wTransmitLength_a = cpu_to_le16(wLen);
- BBvCalculateParameter(pDevice, cbFrameLength, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
-);
- pBuf->wTransmitLength_b = cpu_to_le16(wLen);
+ /* Get SignalField, ServiceField & Length */
+ vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate,
+ byPktType, &pBuf->a);
+
+ vnt_get_phy_field(pDevice, cbFrameLength,
+ pDevice->byTopCCKBasicRate,
+ PK_TYPE_11B, &pBuf->b);
+
//Get Duration and TimeStamp
pBuf->wDuration_a = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength,
byPktType, wCurrentRate, bNeedAck, uFragIdx,
@@ -708,15 +706,13 @@ s_uFillDataHead(
} else {
// Auto Fallback
PSTxDataHead_g_FB pBuf = (PSTxDataHead_g_FB)pTxDataHead;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_a), (unsigned char *)&(pBuf->bySignalField_a)
-);
- pBuf->wTransmitLength_a = cpu_to_le16(wLen);
- BBvCalculateParameter(pDevice, cbFrameLength, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
-);
- pBuf->wTransmitLength_b = cpu_to_le16(wLen);
+ /* Get SignalField, ServiceField & Length */
+ vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate,
+ byPktType, &pBuf->a);
+
+ vnt_get_phy_field(pDevice, cbFrameLength,
+ pDevice->byTopCCKBasicRate,
+ PK_TYPE_11B, &pBuf->b);
//Get Duration and TimeStamp
pBuf->wDuration_a = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz
@@ -736,11 +732,10 @@ s_uFillDataHead(
if ((byFBOption != AUTO_FB_NONE)) {
// Auto Fallback
PSTxDataHead_a_FB pBuf = (PSTxDataHead_a_FB)pTxDataHead;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
-);
- pBuf->wTransmitLength = cpu_to_le16(wLen);
+ /* Get SignalField, ServiceField & Length */
+ vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate,
+ byPktType, &pBuf->a);
+
//Get Duration and TimeStampOff

pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
@@ -753,11 +748,9 @@ s_uFillDataHead(
return pBuf->wDuration;
} else {
PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
-);
- pBuf->wTransmitLength = cpu_to_le16(wLen);
+ /* Get SignalField, ServiceField & Length */
+ vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate,
+ byPktType, &pBuf->ab);
//Get Duration and TimeStampOff

pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
@@ -770,11 +763,9 @@ s_uFillDataHead(
}
} else {
PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
-);
- pBuf->wTransmitLength = cpu_to_le16(wLen);
+ /* Get SignalField, ServiceField & Length */
+ vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate,
+ byPktType, &pBuf->ab);
//Get Duration and TimeStampOff
pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, byPktType,
wCurrentRate, bNeedAck, uFragIdx,
@@ -801,7 +792,6 @@ s_vFillRTSHead(
)
{
unsigned int uRTSFrameLen = 20;
- unsigned short wLen = 0x0000;

if (pvRTS == NULL)
return;
@@ -817,15 +807,14 @@ s_vFillRTSHead(
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,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
-);
- pBuf->wTransmitLength_b = cpu_to_le16(wLen);
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_a), (unsigned char *)&(pBuf->bySignalField_a)
-);
- pBuf->wTransmitLength_a = cpu_to_le16(wLen);
+ /* Get SignalField, ServiceField & Length */
+ vnt_get_phy_field(pDevice, uRTSFrameLen,
+ pDevice->byTopCCKBasicRate,
+ PK_TYPE_11B, &pBuf->b);
+
+ vnt_get_phy_field(pDevice, uRTSFrameLen,
+ pDevice->byTopOFDMBasicRate,
+ byPktType, &pBuf->a);
//Get Duration
pBuf->wDuration_bb = cpu_to_le16((unsigned short)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((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3: 2.4G OFDMData
@@ -847,16 +836,14 @@ s_vFillRTSHead(

} else {
PSRTS_g_FB pBuf = (PSRTS_g_FB)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
-);
- pBuf->wTransmitLength_b = cpu_to_le16(wLen);
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_a), (unsigned char *)&(pBuf->bySignalField_a)
-);
- pBuf->wTransmitLength_a = cpu_to_le16(wLen);
-
+ /* Get SignalField, ServiceField & Length */
+ vnt_get_phy_field(pDevice, uRTSFrameLen,
+ pDevice->byTopCCKBasicRate,
+ PK_TYPE_11B, &pBuf->b);
+
+ vnt_get_phy_field(pDevice, uRTSFrameLen,
+ pDevice->byTopOFDMBasicRate,
+ byPktType, &pBuf->a);
//Get Duration
pBuf->wDuration_bb = cpu_to_le16((unsigned short)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((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3:2.4G OFDMData
@@ -885,11 +872,10 @@ s_vFillRTSHead(
} 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,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
-);
- pBuf->wTransmitLength = cpu_to_le16(wLen);
+ /* Get SignalField, ServiceField & Length */
+ vnt_get_phy_field(pDevice, uRTSFrameLen,
+ pDevice->byTopOFDMBasicRate,
+ byPktType, &pBuf->ab);
//Get Duration
pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData
pBuf->Data.wDurationID = pBuf->wDuration;
@@ -910,11 +896,10 @@ s_vFillRTSHead(

} else {
PSRTS_a_FB pBuf = (PSRTS_a_FB)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
-);
- pBuf->wTransmitLength = cpu_to_le16(wLen);
+ /* Get SignalField, ServiceField & Length */
+ vnt_get_phy_field(pDevice, uRTSFrameLen,
+ pDevice->byTopOFDMBasicRate,
+ byPktType, &pBuf->a);
//Get Duration
pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData
pBuf->wRTSDuration_f0 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //5:RTSDuration_aa_f0, 0:5G, 0: 5G OFDMData
@@ -936,11 +921,10 @@ s_vFillRTSHead(
}
} else if (byPktType == PK_TYPE_11B) {
PSRTS_ab pBuf = (PSRTS_ab)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
-);
- pBuf->wTransmitLength = cpu_to_le16(wLen);
+ /* Get SignalField, ServiceField & Length */
+ vnt_get_phy_field(pDevice, uRTSFrameLen,
+ pDevice->byTopCCKBasicRate,
+ PK_TYPE_11B, &pBuf->ab);
//Get Duration
pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData
pBuf->Data.wDurationID = pBuf->wDuration;
@@ -976,7 +960,6 @@ s_vFillCTSHead(
)
{
unsigned int uCTSFrameLen = 14;
- unsigned short wLen = 0x0000;

if (pvCTS == NULL)
return;
@@ -991,12 +974,10 @@ s_vFillCTSHead(
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,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
-);
-
- pBuf->wTransmitLength_b = cpu_to_le16(wLen);
+ /* Get SignalField, ServiceField & Length */
+ vnt_get_phy_field(pDevice, uCTSFrameLen,
+ pDevice->byTopCCKBasicRate,
+ PK_TYPE_11B, &pBuf->b);

pBuf->wDuration_ba = (unsigned short)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data
pBuf->wDuration_ba += pDevice->wCTSDuration;
@@ -1017,11 +998,11 @@ s_vFillCTSHead(

} 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,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
-);
- pBuf->wTransmitLength_b = cpu_to_le16(wLen);
+ /* Get SignalField, ServiceField & Length */
+ vnt_get_phy_field(pDevice, uCTSFrameLen,
+ pDevice->byTopCCKBasicRate,
+ PK_TYPE_11B, &pBuf->b);
+
//Get CTSDuration_ba
pBuf->wDuration_ba = cpu_to_le16((unsigned short)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;
@@ -2358,7 +2339,6 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, PSTxMgmtPacket pPacket)
PSTxDataHead_ab pTxDataHead = (PSTxDataHead_ab) (pbyBuffer + wTxBufSize);
PS802_11Header pMACHeader;
unsigned short wCurrentRate;
- unsigned short wLen = 0x0000;

memset(pTxBufHead, 0, wTxBufSize);

@@ -2387,10 +2367,9 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, PSTxMgmtPacket pPacket)
wCurrentRate, false, 0, 0, 1, AUTO_FB_NONE));
}

- BBvCalculateParameter(pDevice, cbFrameSize, wCurrentRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pTxDataHead->byServiceField), (unsigned char *)&(pTxDataHead->bySignalField)
-);
- pTxDataHead->wTransmitLength = cpu_to_le16(wLen);
+ vnt_get_phy_field(pDevice, cbFrameSize,
+ wCurrentRate, byPktType, &pTxDataHead->ab);
+
//Get TimeStampOff
pTxDataHead->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
cbHeaderSize = wTxBufSize + sizeof(STxDataHead_ab);
--
1.9.1