2014-08-30 21:26:25

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 01/23] staging: vt6655: rxtx replace typedef struct tagSRrvTime_gRTS with struct vnt_rrv_time_rts

Replacing members
wRTSTxRrvTime_ba, wRTSTxRrvTime_aa, wRTSTxRrvTime_bb, wReserved, wTxRrvTime_b and wTxRrvTime_a
with
rts_rrv_time_ba, rts_rrv_time_aa, rts_rrv_time_bb, reserved, rrv_time_b and rrv_time_a

Creating the new structure in rxtx.h and Using __le16 where necessary

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/desc.h | 11 -----------
drivers/staging/vt6655/rxtx.c | 32 ++++++++++++++++----------------
drivers/staging/vt6655/rxtx.h | 10 ++++++++++
3 files changed, 26 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index b5730df..49a2e04 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -331,17 +331,6 @@ typedef const STxSyncDesc *PCSTxSyncDesc;
//
// RsvTime buffer header
//
-typedef struct tagSRrvTime_gRTS {
- unsigned short wRTSTxRrvTime_ba;
- unsigned short wRTSTxRrvTime_aa;
- unsigned short wRTSTxRrvTime_bb;
- unsigned short wReserved;
- unsigned short wTxRrvTime_b;
- unsigned short wTxRrvTime_a;
-} __attribute__ ((__packed__))
-SRrvTime_gRTS, *PSRrvTime_gRTS;
-typedef const SRrvTime_gRTS *PCSRrvTime_gRTS;
-
typedef struct tagSRrvTime_gCTS {
unsigned short wCTSTxRrvTime_ba;
unsigned short wReserved;
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 7493db1..609aec8 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -1081,13 +1081,13 @@ s_vGenerateTxParameter(
if (pvRTS != NULL) { //RTS_need
//Fill RsvTime
if (pvRrvTime) {
- PSRrvTime_gRTS pBuf = (PSRrvTime_gRTS)pvRrvTime;
+ struct vnt_rrv_time_rts *buf = pvRrvTime;

- pBuf->wRTSTxRrvTime_aa = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 1:2.4GHz
- pBuf->wRTSTxRrvTime_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate));//1:RTSTxRrvTime_ba, 1:2.4GHz
- pBuf->wRTSTxRrvTime_bb = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz
- pBuf->wTxRrvTime_a = cpu_to_le16((unsigned short) s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM
- pBuf->wTxRrvTime_b = cpu_to_le16((unsigned short) s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));//1:CCK
+ buf->rts_rrv_time_aa = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));
+ buf->rts_rrv_time_ba = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate));
+ buf->rts_rrv_time_bb = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));
+ buf->rrv_time_a = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));
+ buf->rrv_time_b = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));
}
//Fill RTS
s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
@@ -1312,12 +1312,12 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,

if (byFBOption == AUTO_FB_NONE) {
if (bRTS == true) {//RTS_need
- pvRrvTime = (PSRrvTime_gRTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS));
- pvRTS = (PSRTS_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR);
+ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts));
+ pvRTS = (PSRTS_g)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + 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);
+ pvTxDataHd = (PSTxDataHead_g)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(SRTS_g));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(SRTS_g) + sizeof(STxDataHead_g);
} else { //RTS_needless
pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
@@ -1329,12 +1329,12 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
} else {
// Auto Fall Back
if (bRTS == true) {//RTS_need
- pvRrvTime = (PSRrvTime_gRTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS));
- pvRTS = (PSRTS_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR);
+ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts));
+ pvRTS = (PSRTS_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + 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);
+ pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(SRTS_g_FB));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(SRTS_g_FB) + sizeof(STxDataHead_g_FB);
} else { //RTS_needless
pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h
index 789fae7..f5f6478 100644
--- a/drivers/staging/vt6655/rxtx.h
+++ b/drivers/staging/vt6655/rxtx.h
@@ -56,6 +56,16 @@ struct vnt_mic_hdr {
u16 packing; /* packing to 48 bytes */
} __packed;

+/* RsvTime buffer header */
+struct vnt_rrv_time_rts {
+ __le16 rts_rrv_time_ba;
+ __le16 rts_rrv_time_aa;
+ __le16 rts_rrv_time_bb;
+ u16 reserved;
+ __le16 rrv_time_b;
+ __le16 rrv_time_a;
+} __packed;
+
struct vnt_tx_short_buf_head {
__le16 fifo_ctl;
u16 time_stamp;
--
1.9.1



2014-08-30 21:26:58

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 20/23] staging: vt6655: replace typedef struct tagSCTS_FB with struct vnt_cts_fb

Replacing members
b, wDuration_ba, wReserved, wCTSDuration_ba_f0, wCTSDuration_ba_f1, data and
reserved2.

With
b, duration_ba, reserved, cts_duration_ba_f0, cts_duration_ba_f1, data and
reserved2

unsigned short is replaced with u16 or __le16 where necessary.

cast void pointer to pvCTS

Creating the new structure in rxtx.h

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/desc.h | 15 -------------
drivers/staging/vt6655/rxtx.c | 50 ++++++++++++++++++++++++++-----------------
drivers/staging/vt6655/rxtx.h | 10 +++++++++
3 files changed, 40 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 4d9027e..5a2bbd2 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -353,21 +353,6 @@ union vnt_phy_field_swap {
};

//
-// CTS buffer header
-//
-typedef struct tagSCTS_FB {
- struct vnt_phy_field b;
- unsigned short wDuration_ba;
- unsigned short wReserved;
- unsigned short wCTSDuration_ba_f0;
- unsigned short wCTSDuration_ba_f1;
- struct ieee80211_cts data;
- u16 reserved2;
-} __attribute__ ((__packed__))
-SCTS_FB, *PSCTS_FB;
-typedef const SCTS_FB *PCSCTS_FB;
-
-//
// Tx FIFO header
//
typedef struct tagSTxBufHead {
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index d3de73c..6b22f09 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -1043,33 +1043,42 @@ s_vFillCTSHead(
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;
+ struct vnt_cts_fb *buf = pvCTS;
/* 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;
- pBuf->wDuration_ba = cpu_to_le16(pBuf->wDuration_ba);
- //Get CTSDuration_ba_f0
- pBuf->wCTSDuration_ba_f0 = (unsigned short)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);
+ PK_TYPE_11B, &buf->b);
+
+ buf->duration_ba = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength,
+ byPktType, wCurrentRate, bNeedAck, byFBOption);
+ buf->duration_ba += pDevice->wCTSDuration;
+
+ buf->duration_ba = cpu_to_le16(buf->duration_ba);
+ /* Get CTSDuration_ba_f0 */
+ buf->cts_duration_ba_f0 = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F0, cbFrameLength,
+ byPktType, wCurrentRate,
+ bNeedAck, byFBOption);
+
+ buf->cts_duration_ba_f0 += pDevice->wCTSDuration;
+
+ buf->cts_duration_ba_f0 = cpu_to_le16(buf->cts_duration_ba_f0);
//Get CTSDuration_ba_f1
- pBuf->wCTSDuration_ba_f1 = (unsigned short)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);
+ buf->cts_duration_ba_f1 = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F1, cbFrameLength,
+ byPktType, wCurrentRate,
+ bNeedAck, byFBOption);
+ buf->cts_duration_ba_f1 += pDevice->wCTSDuration;
+
+ buf->cts_duration_ba_f1 = cpu_to_le16(buf->cts_duration_ba_f1);
/* Get CTS Frame body */
- pBuf->data.duration = pBuf->wDuration_ba;
+ buf->data.duration = buf->duration_ba;

- pBuf->data.frame_control =
+ buf->data.frame_control =
cpu_to_le16(IEEE80211_FTYPE_CTL |
IEEE80211_STYPE_CTS);

- pBuf->reserved2 = 0x0;
- memcpy(&pBuf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN);
+ buf->reserved2 = 0x0;

+ memcpy(&buf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN);
} else { //if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA)
struct vnt_cts *buf = pvCTS;
/* Get SignalField, ServiceField & Length */
@@ -1414,10 +1423,11 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts));
pvRTS = NULL;
- pvCTS = (PSCTS_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR);
- pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(SCTS_FB));
+ pvCTS = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR);
+ pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
+ cbMICHDR + sizeof(struct vnt_cts_fb));
cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
- cbMICHDR + sizeof(SCTS_FB) + sizeof(struct vnt_tx_datahead_g_fb);
+ cbMICHDR + sizeof(struct vnt_cts_fb) + sizeof(struct vnt_tx_datahead_g_fb);
}
} // Auto Fall Back
} else {//802.11a/b packet
diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h
index 2c09c11..8ee6288 100644
--- a/drivers/staging/vt6655/rxtx.h
+++ b/drivers/staging/vt6655/rxtx.h
@@ -163,6 +163,16 @@ struct vnt_cts {
u16 reserved2;
} __packed;

+struct vnt_cts_fb {
+ struct vnt_phy_field b;
+ __le16 duration_ba;
+ u16 reserved;
+ __le16 cts_duration_ba_f0;
+ __le16 cts_duration_ba_f1;
+ struct ieee80211_cts data;
+ u16 reserved2;
+} __packed;
+
struct vnt_tx_short_buf_head {
__le16 fifo_ctl;
u16 time_stamp;
--
1.9.1


2014-08-30 21:26:31

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 05/23] staging: vt6655: rxtx change s_uGetRTSCTSRsvTime to always return __le16

s_uGetRTSCTSRsvTime always needs to return little endian __le16

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

diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 627bfbd..ee20ae2 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -375,7 +375,7 @@ static __le16 vnt_rxtx_rsvtime_le16(struct vnt_private *priv, u8 pkt_type,

//byFreqType: 0=>5GHZ 1=>2.4GHZ
static
-unsigned int
+__le16
s_uGetRTSCTSRsvTime(
struct vnt_private *pDevice,
unsigned char byRTSRsvType,
@@ -403,12 +403,12 @@ s_uGetRTSCTSRsvTime(
uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
uRrvTime = uCTSTime + uAckTime + uDataTime + 2*pDevice->uSIFS;
- return uRrvTime;
+ return cpu_to_le16((u16)uRrvTime);
}

//RTSRrvTime
uRrvTime = uRTSTime + uCTSTime + uAckTime + uDataTime + 3*pDevice->uSIFS;
- return uRrvTime;
+ return cpu_to_le16((u16)uRrvTime);
}

//byFreqType 0: 5GHz, 1:2.4Ghz
@@ -1090,9 +1090,9 @@ s_vGenerateTxParameter(
if (pvRrvTime) {
struct vnt_rrv_time_rts *buf = pvRrvTime;

- buf->rts_rrv_time_aa = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));
- buf->rts_rrv_time_ba = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate));
- buf->rts_rrv_time_bb = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));
+ buf->rts_rrv_time_aa = s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate);
+ buf->rts_rrv_time_ba = s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate);
+ buf->rts_rrv_time_bb = s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate);
buf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);
buf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK);
}
@@ -1106,7 +1106,7 @@ s_vGenerateTxParameter(

buf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);
buf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK);
- buf->cts_rrv_time_ba = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate));
+ buf->cts_rrv_time_ba = s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate);
}

//Fill CTS
@@ -1118,7 +1118,7 @@ s_vGenerateTxParameter(
if (pvRrvTime) {
struct vnt_rrv_time_ab *buf = pvRrvTime;

- buf->rts_rrv_time = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));
+ buf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate);
buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);
}
//Fill RTS
@@ -1137,7 +1137,7 @@ s_vGenerateTxParameter(
if (pvRrvTime) {
struct vnt_rrv_time_ab *buf = pvRrvTime;

- buf->rts_rrv_time = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));
+ buf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate);
buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK);
}
//Fill RTS
--
1.9.1


2014-08-30 21:26:30

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 04/23] staging: vt6655: create vnt_rxtx_rsvtime_le16 to return s_uGetTxRsvTime endian corrected.

Replace s_uGetTxRsvTime where endian correction is needed.

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

diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index a0b8384..627bfbd 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -366,6 +366,13 @@ s_uGetTxRsvTime(
return uDataTime;
}

+static __le16 vnt_rxtx_rsvtime_le16(struct vnt_private *priv, u8 pkt_type,
+ u32 frame_length, u16 rate, bool need_ack)
+{
+ return cpu_to_le16((u16)s_uGetTxRsvTime(priv, pkt_type,
+ frame_length, rate, need_ack));
+}
+
//byFreqType: 0=>5GHZ 1=>2.4GHZ
static
unsigned int
@@ -1086,8 +1093,8 @@ s_vGenerateTxParameter(
buf->rts_rrv_time_aa = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));
buf->rts_rrv_time_ba = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate));
buf->rts_rrv_time_bb = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));
- buf->rrv_time_a = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));
- buf->rrv_time_b = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));
+ buf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);
+ buf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK);
}
//Fill RTS
s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
@@ -1097,8 +1104,8 @@ s_vGenerateTxParameter(
if (pvRrvTime) {
struct vnt_rrv_time_cts *buf = pvRrvTime;

- buf->rrv_time_a = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));
- buf->rrv_time_b = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));
+ buf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);
+ buf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK);
buf->cts_rrv_time_ba = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate));
}

@@ -1112,7 +1119,7 @@ s_vGenerateTxParameter(
struct vnt_rrv_time_ab *buf = pvRrvTime;

buf->rts_rrv_time = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));
- buf->rrv_time = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));
+ buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);
}
//Fill RTS
s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
@@ -1121,7 +1128,7 @@ s_vGenerateTxParameter(
if (pvRrvTime) {
struct vnt_rrv_time_ab *buf = pvRrvTime;

- buf->rrv_time = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11A, cbFrameSize, wCurrentRate, bNeedACK));
+ buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11A, cbFrameSize, wCurrentRate, bNeedACK);
}
}
} else if (byPktType == PK_TYPE_11B) {
@@ -1131,7 +1138,7 @@ s_vGenerateTxParameter(
struct vnt_rrv_time_ab *buf = pvRrvTime;

buf->rts_rrv_time = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));
- buf->rrv_time = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK));
+ buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK);
}
//Fill RTS
s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
@@ -1140,7 +1147,7 @@ s_vGenerateTxParameter(
if (pvRrvTime) {
struct vnt_rrv_time_ab *buf = pvRrvTime;

- buf->rrv_time = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK));
+ buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK);
}
}
}
--
1.9.1


2014-08-30 21:26:53

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 17/23] staging: vt6655: replace typedef struct tagSRTS_ab with struct vnt_rts_ab

Replacing members
ab, wDuration, wReserved and data

with

ab, duration, reserved and data

replacing unsigned short with u16 and __le16 where necessary.

pvRTS is void pointer.

Creating the new structure in rxtx.h

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/desc.h | 9 --------
drivers/staging/vt6655/rxtx.c | 52 ++++++++++++++++++++++++-------------------
drivers/staging/vt6655/rxtx.h | 7 ++++++
3 files changed, 36 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index e1c686e..de459d8 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -352,15 +352,6 @@ union vnt_phy_field_swap {
u32 field_write;
};

-typedef struct tagSRTS_ab {
- struct vnt_phy_field ab;
- unsigned short wDuration;
- unsigned short wReserved;
- struct ieee80211_rts data;
-} __attribute__ ((__packed__))
-SRTS_ab, *PSRTS_ab;
-typedef const SRTS_ab *PCSRTS_ab;
-
typedef struct tagSRTS_a_FB {
struct vnt_phy_field a;
unsigned short wDuration;
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index a0d379a..420fcf5 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -920,31 +920,34 @@ s_vFillRTSHead(
} // if (byFBOption == AUTO_FB_NONE)
} else if (byPktType == PK_TYPE_11A) {
if (byFBOption == AUTO_FB_NONE) {
- PSRTS_ab pBuf = (PSRTS_ab)pvRTS;
+ struct vnt_rts_ab *buf = pvRTS;
/* 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.duration = pBuf->wDuration;
+ byPktType, &buf->ab);
+ /* Get Duration */
+ buf->duration =
+ cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength,
+ byPktType, wCurrentRate, bNeedAck,
+ byFBOption));
+ buf->data.duration = buf->duration;
/* Get RTS Frame body */
- pBuf->data.frame_control =
+ buf->data.frame_control =
cpu_to_le16(IEEE80211_FTYPE_CTL |
IEEE80211_STYPE_RTS);


if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&pBuf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
+ memcpy(&buf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
} else {
- memcpy(&pBuf->data.ra, pDevice->abyBSSID, ETH_ALEN);
+ memcpy(&buf->data.ra, pDevice->abyBSSID, ETH_ALEN);
}

if (pDevice->eOPMode == OP_MODE_AP)
- memcpy(&pBuf->data.ta, pDevice->abyBSSID, ETH_ALEN);
+ memcpy(&buf->data.ta, pDevice->abyBSSID, ETH_ALEN);
else
- memcpy(&pBuf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);
+ memcpy(&buf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);

} else {
PSRTS_a_FB pBuf = (PSRTS_a_FB)pvRTS;
@@ -975,29 +978,32 @@ s_vFillRTSHead(
memcpy(&pBuf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);
}
} else if (byPktType == PK_TYPE_11B) {
- PSRTS_ab pBuf = (PSRTS_ab)pvRTS;
+ struct vnt_rts_ab *buf = pvRTS;
/* 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.duration = pBuf->wDuration;
+ PK_TYPE_11B, &buf->ab);
+ /* Get Duration */
+ buf->duration =
+ cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength,
+ byPktType, wCurrentRate, bNeedAck,
+ byFBOption));
+ buf->data.duration = buf->duration;
/* Get RTS Frame body */
- pBuf->data.frame_control =
+ buf->data.frame_control =
cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS);

if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&pBuf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
+ memcpy(&buf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
} else {
- memcpy(&pBuf->data.ra, pDevice->abyBSSID, ETH_ALEN);
+ memcpy(&buf->data.ra, pDevice->abyBSSID, ETH_ALEN);
}

if (pDevice->eOPMode == OP_MODE_AP)
- memcpy(&pBuf->data.ta, pDevice->abyBSSID, ETH_ALEN);
+ memcpy(&buf->data.ta, pDevice->abyBSSID, ETH_ALEN);
else
- memcpy(&pBuf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);
+ memcpy(&buf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);
}
}

@@ -1408,12 +1414,12 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
if (bRTS == true) {
pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
- pvRTS = (PSRTS_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
+ pvRTS = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
pvCTS = NULL;
pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize +
- sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(SRTS_ab));
+ sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(struct vnt_rts_ab));
cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) +
- cbMICHDR + sizeof(SRTS_ab) + sizeof(struct vnt_tx_datahead_ab);
+ cbMICHDR + sizeof(struct vnt_rts_ab) + sizeof(struct vnt_tx_datahead_ab);
} else { //RTS_needless, need MICHDR
pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h
index b9153e0..807753c 100644
--- a/drivers/staging/vt6655/rxtx.h
+++ b/drivers/staging/vt6655/rxtx.h
@@ -138,6 +138,13 @@ struct vnt_rts_g_fb {
struct ieee80211_rts data;
} __packed;

+struct vnt_rts_ab {
+ struct vnt_phy_field ab;
+ __le16 duration;
+ u16 reserved;
+ struct ieee80211_rts data;
+} __packed;
+
struct vnt_tx_short_buf_head {
__le16 fifo_ctl;
u16 time_stamp;
--
1.9.1


2014-08-30 21:26:38

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 09/23] staging: vt6655: replace typedef struct tagSTxDataHead_g_FB with struct vnt_tx_datahead_g_fb

Replacing members
b, a, wDuration_b, wDuration_a, wDuration_a_f0, wDuration_a_f1, wTimeStampOff_b and wTimeStampOff_a
with
b, a, duration_b, duration_a, duration_a_f0, duration_a_f1, time_stamp_off_b and time_stamp_off_a

All unsigned short need to be __le16 type.

Creating the new structure in rxtx.h

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/desc.h | 13 ------------
drivers/staging/vt6655/rxtx.c | 46 ++++++++++++++++++++++---------------------
drivers/staging/vt6655/rxtx.h | 11 +++++++++++
3 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 27b6fd7..0945c07 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -459,19 +459,6 @@ typedef const STxBufHead *PCSTxBufHead;
//
// Tx data header
//
-typedef struct tagSTxDataHead_g_FB {
- struct vnt_phy_field b;
- struct vnt_phy_field a;
- unsigned short wDuration_b;
- unsigned short wDuration_a;
- unsigned short wDuration_a_f0;
- unsigned short wDuration_a_f1;
- unsigned short wTimeStampOff_b;
- unsigned short wTimeStampOff_a;
-} __attribute__ ((__packed__))
-STxDataHead_g_FB, *PSTxDataHead_g_FB;
-typedef const STxDataHead_g_FB *PCSTxDataHead_g_FB;
-
typedef struct tagSTxDataHead_ab {
struct vnt_phy_field ab;
unsigned short wDuration;
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 97b84df..d8e3347 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -717,29 +717,29 @@ s_uFillDataHead(

return buf->duration_a;
} else {
- // Auto Fallback
- PSTxDataHead_g_FB pBuf = (PSTxDataHead_g_FB)pTxDataHead;
+ /* Auto Fallback */
+ struct vnt_tx_datahead_g_fb *buf = pTxDataHead;
/* Get SignalField, ServiceField & Length */
vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate,
- byPktType, &pBuf->a);
+ byPktType, &buf->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
- pBuf->wDuration_b = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, PK_TYPE_11B,
- pDevice->byTopCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz
- pBuf->wDuration_a_f0 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz
- pBuf->wDuration_a_f1 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz
-
- pBuf->wTimeStampOff_a = vnt_time_stamp_off(pDevice, wCurrentRate);
- pBuf->wTimeStampOff_b = vnt_time_stamp_off(pDevice, pDevice->byTopCCKBasicRate);
-
- return pBuf->wDuration_a;
+ PK_TYPE_11B, &buf->b);
+ /* Get Duration and TimeStamp */
+ buf->duration_a = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
+ buf->duration_b = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, PK_TYPE_11B,
+ pDevice->byTopCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
+ buf->duration_a_f0 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
+ buf->duration_a_f1 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
+
+ buf->time_stamp_off_a = vnt_time_stamp_off(pDevice, wCurrentRate);
+ buf->time_stamp_off_b = vnt_time_stamp_off(pDevice, pDevice->byTopCCKBasicRate);
+
+ return buf->duration_a;
} //if (byFBOption == AUTO_FB_NONE)
} else if (byPktType == PK_TYPE_11A) {
if ((byFBOption != AUTO_FB_NONE)) {
@@ -1335,15 +1335,17 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts));
pvRTS = (PSRTS_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR);
pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(SRTS_g_FB));
- cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(SRTS_g_FB) + sizeof(STxDataHead_g_FB);
+ pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(SRTS_g_FB));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) +
+ cbMICHDR + sizeof(SRTS_g_FB) + sizeof(struct vnt_tx_datahead_g_fb);
} else { //RTS_needless
pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts));
pvRTS = NULL;
pvCTS = (PSCTS_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR);
- pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(SCTS_FB));
- cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(SCTS_FB) + sizeof(STxDataHead_g_FB);
+ pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(SCTS_FB));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
+ cbMICHDR + sizeof(SCTS_FB) + sizeof(struct vnt_tx_datahead_g_fb);
}
} // Auto Fall Back
} else {//802.11a/b packet
diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h
index 0fe9998..212c2ef 100644
--- a/drivers/staging/vt6655/rxtx.h
+++ b/drivers/staging/vt6655/rxtx.h
@@ -88,6 +88,17 @@ struct vnt_tx_datahead_g {
__le16 time_stamp_off_a;
} __packed;

+struct vnt_tx_datahead_g_fb {
+ struct vnt_phy_field b;
+ struct vnt_phy_field a;
+ __le16 duration_b;
+ __le16 duration_a;
+ __le16 duration_a_f0;
+ __le16 duration_a_f1;
+ __le16 time_stamp_off_b;
+ __le16 time_stamp_off_a;
+} __packed;
+
struct vnt_tx_short_buf_head {
__le16 fifo_ctl;
u16 time_stamp;
--
1.9.1


2014-08-30 21:26:27

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 02/23] staging: vt6655: rxtx replace typedef struct tagSRrvTime_gCTS with struct vnt_rrv_time_cts

replacing members
wCTSTxRrvTime_ba, wReserved, wTxRrvTime_b and wTxRrvTime_a
with
cts_rrv_time_ba, reserved, rrv_time_b and rrv_time_a;

Creating the new structure in rxtx.h and Using __le16 where necessary

pvRrvTime is a void pointer

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/desc.h | 9 --------
drivers/staging/vt6655/rxtx.c | 54 ++++++++++++++++++++++++-------------------
drivers/staging/vt6655/rxtx.h | 7 ++++++
3 files changed, 37 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 49a2e04..237a99c 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -331,15 +331,6 @@ typedef const STxSyncDesc *PCSTxSyncDesc;
//
// RsvTime buffer header
//
-typedef struct tagSRrvTime_gCTS {
- unsigned short wCTSTxRrvTime_ba;
- unsigned short wReserved;
- unsigned short wTxRrvTime_b;
- unsigned short wTxRrvTime_a;
-} __attribute__ ((__packed__))
-SRrvTime_gCTS, *PSRrvTime_gCTS;
-typedef const SRrvTime_gCTS *PCSRrvTime_gCTS;
-
typedef struct tagSRrvTime_ab {
unsigned short wRTSTxRrvTime;
unsigned short wTxRrvTime;
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 609aec8..b2fd513 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -1095,11 +1095,11 @@ s_vGenerateTxParameter(

//Fill RsvTime
if (pvRrvTime) {
- PSRrvTime_gCTS pBuf = (PSRrvTime_gCTS)pvRrvTime;
+ struct vnt_rrv_time_cts *buf = pvRrvTime;

- pBuf->wTxRrvTime_a = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM
- pBuf->wTxRrvTime_b = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));//1:CCK
- pBuf->wCTSTxRrvTime_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate));//3:CTSTxRrvTime_Ba, 1:2.4GHz
+ buf->rrv_time_a = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));
+ buf->rrv_time_b = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));
+ buf->cts_rrv_time_ba = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate));
}

//Fill CTS
@@ -1319,12 +1319,12 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
pvTxDataHd = (PSTxDataHead_g)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(SRTS_g));
cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(SRTS_g) + sizeof(STxDataHead_g);
} else { //RTS_needless
- pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
+ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts));
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);
+ pvCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR);
+ pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(SCTS));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(SCTS) + sizeof(STxDataHead_g);
}
} else {
// Auto Fall Back
@@ -1336,12 +1336,12 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(SRTS_g_FB));
cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(SRTS_g_FB) + sizeof(STxDataHead_g_FB);
} else { //RTS_needless
- pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
+ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts));
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);
+ pvCTS = (PSCTS_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR);
+ pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(SCTS_FB));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(SCTS_FB) + sizeof(STxDataHead_g_FB);
}
} // Auto Fall Back
} else {//802.11a/b packet
@@ -2183,13 +2183,15 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, PSTxMgmtPacket pPacket)

//Set RrvTime/RTS/CTS Buffer
if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet
-
- pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
+ pvRrvTime = (void *) (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);
+ pCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_cts));
+ pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_cts) + sizeof(SCTS));
+ cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
+ sizeof(SCTS) + sizeof(STxDataHead_g);
} else { // 802.11a/b packet
pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
pMICHDR = NULL;
@@ -2668,12 +2670,16 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb,

if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet

- pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
+ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_cts));
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);
+ pvCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_cts) + cbMICHDR);
+ pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(SCTS));
+ cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
+ cbMICHDR + sizeof(SCTS) + sizeof(STxDataHead_g);

} else {//802.11a/b packet

diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h
index f5f6478..4dca615 100644
--- a/drivers/staging/vt6655/rxtx.h
+++ b/drivers/staging/vt6655/rxtx.h
@@ -66,6 +66,13 @@ struct vnt_rrv_time_rts {
__le16 rrv_time_a;
} __packed;

+struct vnt_rrv_time_cts {
+ __le16 cts_rrv_time_ba;
+ u16 reserved;
+ __le16 rrv_time_b;
+ __le16 rrv_time_a;
+} __packed;
+
struct vnt_tx_short_buf_head {
__le16 fifo_ctl;
u16 time_stamp;
--
1.9.1


2014-08-30 21:26:34

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 07/23] staging: vt6655: rxtx.c create function to return __le16 wTimeStampOff

wTimeStampOff always needs to be endian corrected.

Create vnt_time_stamp_off to return this value.

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

diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index afdf3ab..9617701 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -337,6 +337,12 @@ s_vSWencryption(
}
}

+static __le16 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
@@ -706,8 +712,8 @@ s_uFillDataHead(
bNeedAck, uFragIdx, cbLastFragmentSize,
uMACfragNum, byFBOption)); //1: 2.4

- pBuf->wTimeStampOff_a = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
- pBuf->wTimeStampOff_b = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][pDevice->byTopCCKBasicRate%MAX_RATE]);
+ pBuf->wTimeStampOff_a = vnt_time_stamp_off(pDevice, wCurrentRate);
+ pBuf->wTimeStampOff_b = vnt_time_stamp_off(pDevice, pDevice->byTopCCKBasicRate);

return pBuf->wDuration_a;
} else {
@@ -730,8 +736,8 @@ s_uFillDataHead(
pBuf->wDuration_a_f1 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz

- pBuf->wTimeStampOff_a = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
- pBuf->wTimeStampOff_b = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][pDevice->byTopCCKBasicRate%MAX_RATE]);
+ 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)
@@ -751,7 +757,7 @@ s_uFillDataHead(
wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //0: 5GHz
pBuf->wDuration_f1 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //0: 5GHz
- pBuf->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
+ pBuf->wTimeStampOff = vnt_time_stamp_off(pDevice, wCurrentRate);
return pBuf->wDuration;
} else {
PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead;
@@ -765,7 +771,7 @@ s_uFillDataHead(
cbLastFragmentSize, uMACfragNum,
byFBOption));

- pBuf->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
+ pBuf->wTimeStampOff = vnt_time_stamp_off(pDevice, wCurrentRate);
return pBuf->wDuration;
}
} else {
@@ -778,7 +784,7 @@ s_uFillDataHead(
wCurrentRate, bNeedAck, uFragIdx,
cbLastFragmentSize, uMACfragNum,
byFBOption));
- pBuf->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
+ pBuf->wTimeStampOff = vnt_time_stamp_off(pDevice, wCurrentRate);
return pBuf->wDuration;
}
return 0;
@@ -2370,7 +2376,7 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, PSTxMgmtPacket pPacket)
wCurrentRate, byPktType, &short_head->ab);

/* Get TimeStampOff */
- short_head->time_stamp_off = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
+ short_head->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate);
cbHeaderSize = sizeof(struct vnt_tx_short_buf_head);

//Generate Beacon Header
--
1.9.1


2014-08-30 21:26:55

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 18/23] staging: vt6655: replace typedef struct tagSRTS_a_FB with struct vnt_rts_a_fb

Replacing members
a, wDuration, wReserved, wRTSDuration_f0, wRTSDuration_f1 and data
with
a, duration, reserved, rts_duration_f0, rts_duration_f1 and data

unsigned short is replaced with u16 or __le16 where necessary.

cast void pointer to pvRTS

Creating the new structure in rxtx.h

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/desc.h | 11 -----------
drivers/staging/vt6655/rxtx.c | 41 +++++++++++++++++++++++++----------------
drivers/staging/vt6655/rxtx.h | 9 +++++++++
3 files changed, 34 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index de459d8..f0a31a8 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -352,17 +352,6 @@ union vnt_phy_field_swap {
u32 field_write;
};

-typedef struct tagSRTS_a_FB {
- struct vnt_phy_field a;
- unsigned short wDuration;
- unsigned short wReserved;
- unsigned short wRTSDuration_f0;
- unsigned short wRTSDuration_f1;
- struct ieee80211_rts data;
-} __attribute__ ((__packed__))
-SRTS_a_FB, *PSRTS_a_FB;
-typedef const SRTS_a_FB *PCSRTS_a_FB;
-
//
// CTS buffer header
//
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 420fcf5..0721fbb 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -950,32 +950,40 @@ s_vFillRTSHead(
memcpy(&buf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);

} else {
- PSRTS_a_FB pBuf = (PSRTS_a_FB)pvRTS;
+ struct vnt_rts_a_fb *buf = pvRTS;
/* 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
- pBuf->wRTSDuration_f1 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //7:RTSDuration_aa_f1, 0:5G, 0:
- pBuf->data.duration = pBuf->wDuration;
+ byPktType, &buf->a);
+ /* Get Duration */
+ buf->duration =
+ cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength,
+ byPktType, wCurrentRate,
+ bNeedAck, byFBOption));
+ buf->rts_duration_f0 =
+ cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength,
+ byPktType, wCurrentRate,
+ bNeedAck, byFBOption));
+ buf->rts_duration_f1 =
+ cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength,
+ byPktType, wCurrentRate,
+ bNeedAck, byFBOption));
+ buf->data.duration = buf->duration;
/* Get RTS Frame body */
- pBuf->data.frame_control =
+ buf->data.frame_control =
cpu_to_le16(IEEE80211_FTYPE_CTL |
IEEE80211_STYPE_RTS);

-
if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&pBuf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
+ memcpy(&buf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
} else {
- memcpy(&pBuf->data.ra, pDevice->abyBSSID, ETH_ALEN);
+ memcpy(&buf->data.ra, pDevice->abyBSSID, ETH_ALEN);
}
if (pDevice->eOPMode == OP_MODE_AP)
- memcpy(&pBuf->data.ta, pDevice->abyBSSID, ETH_ALEN);
+ memcpy(&buf->data.ta, pDevice->abyBSSID, ETH_ALEN);
else
- memcpy(&pBuf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);
+ memcpy(&buf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);
}
} else if (byPktType == PK_TYPE_11B) {
struct vnt_rts_ab *buf = pvRTS;
@@ -1434,11 +1442,12 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
if (bRTS == true) {//RTS_need
pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
- pvRTS = (PSRTS_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
+ pvRTS = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
pvCTS = NULL;
- pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(SRTS_a_FB));
+ pvTxDataHd = (void *)(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(SRTS_a_FB) + sizeof(struct vnt_tx_datahead_a_fb);
+ cbMICHDR + sizeof(struct vnt_rts_a_fb) + sizeof(struct vnt_tx_datahead_a_fb);
} else { //RTS_needless
pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h
index 807753c..bac2214 100644
--- a/drivers/staging/vt6655/rxtx.h
+++ b/drivers/staging/vt6655/rxtx.h
@@ -145,6 +145,15 @@ struct vnt_rts_ab {
struct ieee80211_rts data;
} __packed;

+struct vnt_rts_a_fb {
+ struct vnt_phy_field a;
+ __le16 duration;
+ u16 reserved;
+ __le16 rts_duration_f0;
+ __le16 rts_duration_f1;
+ struct ieee80211_rts data;
+} __packed;
+
struct vnt_tx_short_buf_head {
__le16 fifo_ctl;
u16 time_stamp;
--
1.9.1


2014-08-30 21:27:02

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 22/23] staging: vt6655: s_uGetRTSCTSDuration always return __le16

This function should always return __le16, move all endian
correction to here.

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

diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 3c8c499..0c69193 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -578,7 +578,7 @@ s_uGetDataDuration(

//byFreqType: 0=>5GHZ 1=>2.4GHZ
static
-unsigned int
+__le16
s_uGetRTSCTSDuration(
struct vnt_private *pDevice,
unsigned char byDurType,
@@ -667,7 +667,7 @@ s_uGetRTSCTSDuration(
break;
}

- return uDurTime;
+ return cpu_to_le16((u16)uDurTime);
}

static
@@ -829,17 +829,20 @@ s_vFillRTSHead(
byPktType, &buf->a);
/* Get Duration */
buf->duration_bb =
- cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength,
- PK_TYPE_11B, pDevice->byTopCCKBasicRate,
- bNeedAck, byFBOption));
+ s_uGetRTSCTSDuration(pDevice, RTSDUR_BB,
+ cbFrameLength, PK_TYPE_11B,
+ pDevice->byTopCCKBasicRate,
+ bNeedAck, byFBOption);
buf->duration_aa =
- cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength,
- byPktType, wCurrentRate, bNeedAck,
- byFBOption));
+ s_uGetRTSCTSDuration(pDevice, RTSDUR_AA,
+ cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck,
+ byFBOption);
buf->duration_ba =
- cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength,
- byPktType, wCurrentRate, bNeedAck,
- byFBOption));
+ s_uGetRTSCTSDuration(pDevice, RTSDUR_BA,
+ cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck,
+ byFBOption);

buf->data.duration = buf->duration_aa;
/* Get RTS Frame body */
@@ -871,33 +874,40 @@ s_vFillRTSHead(
byPktType, &buf->a);
/* Get Duration */
buf->duration_bb =
- cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength,
- PK_TYPE_11B, pDevice->byTopCCKBasicRate,
- bNeedAck, byFBOption));
+ s_uGetRTSCTSDuration(pDevice, RTSDUR_BB,
+ cbFrameLength, PK_TYPE_11B,
+ pDevice->byTopCCKBasicRate,
+ bNeedAck, byFBOption);
buf->duration_aa =
- cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength,
- byPktType, wCurrentRate, bNeedAck,
- byFBOption));
+ s_uGetRTSCTSDuration(pDevice, RTSDUR_AA,
+ cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck,
+ byFBOption);
buf->duration_ba =
- cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength,
- byPktType, wCurrentRate, bNeedAck,
- byFBOption));
+ s_uGetRTSCTSDuration(pDevice, RTSDUR_BA,
+ cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck,
+ byFBOption);
buf->rts_duration_ba_f0 =
- cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F0, cbFrameLength,
- byPktType, wCurrentRate, bNeedAck,
- byFBOption));
+ s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F0,
+ cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck,
+ byFBOption);
buf->rts_duration_aa_f0 =
- cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength,
- byPktType, wCurrentRate, bNeedAck,
- byFBOption));
+ s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0,
+ cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck,
+ byFBOption);
buf->rts_duration_ba_f1 =
- cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F1, cbFrameLength,
- byPktType, wCurrentRate, bNeedAck,
- byFBOption));
+ s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F1,
+ cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck,
+ byFBOption);
buf->rts_duration_aa_f1 =
- cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength,
- byPktType, wCurrentRate, bNeedAck,
- byFBOption));
+ s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1,
+ cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck,
+ byFBOption);
buf->data.duration = buf->duration_aa;
/* Get RTS Frame body */
buf->data.frame_control =
@@ -927,9 +937,10 @@ s_vFillRTSHead(
byPktType, &buf->ab);
/* Get Duration */
buf->duration =
- cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength,
- byPktType, wCurrentRate, bNeedAck,
- byFBOption));
+ s_uGetRTSCTSDuration(pDevice, RTSDUR_AA,
+ cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck,
+ byFBOption);
buf->data.duration = buf->duration;
/* Get RTS Frame body */
buf->data.frame_control =
@@ -957,17 +968,20 @@ s_vFillRTSHead(
byPktType, &buf->a);
/* Get Duration */
buf->duration =
- cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength,
- byPktType, wCurrentRate,
- bNeedAck, byFBOption));
+ s_uGetRTSCTSDuration(pDevice, RTSDUR_AA,
+ cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck,
+ byFBOption);
buf->rts_duration_f0 =
- cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength,
- byPktType, wCurrentRate,
- bNeedAck, byFBOption));
+ s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0,
+ cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck,
+ byFBOption);
buf->rts_duration_f1 =
- cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength,
- byPktType, wCurrentRate,
- bNeedAck, byFBOption));
+ s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1,
+ cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck,
+ byFBOption);
buf->data.duration = buf->duration;
/* Get RTS Frame body */
buf->data.frame_control =
@@ -993,9 +1007,10 @@ s_vFillRTSHead(
PK_TYPE_11B, &buf->ab);
/* Get Duration */
buf->duration =
- cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength,
- byPktType, wCurrentRate, bNeedAck,
- byFBOption));
+ s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength,
+ byPktType, wCurrentRate, bNeedAck,
+ byFBOption);
+
buf->data.duration = buf->duration;
/* Get RTS Frame body */
buf->data.frame_control =
@@ -1049,21 +1064,26 @@ s_vFillCTSHead(
pDevice->byTopCCKBasicRate,
PK_TYPE_11B, &buf->b);

- buf->duration_ba = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength,
- byPktType, wCurrentRate, bNeedAck, byFBOption);
- buf->duration_ba = cpu_to_le16(buf->duration_ba);
- /* Get CTSDuration_ba_f0 */
- buf->cts_duration_ba_f0 = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F0, cbFrameLength,
- byPktType, wCurrentRate,
- bNeedAck, byFBOption);
+ buf->duration_ba =
+ s_uGetRTSCTSDuration(pDevice, CTSDUR_BA,
+ cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck,
+ byFBOption);

- buf->cts_duration_ba_f0 = cpu_to_le16(buf->cts_duration_ba_f0);
- //Get CTSDuration_ba_f1
- buf->cts_duration_ba_f1 = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F1, cbFrameLength,
- byPktType, wCurrentRate,
- bNeedAck, byFBOption);
+ /* Get CTSDuration_ba_f0 */
+ buf->cts_duration_ba_f0 =
+ s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F0,
+ cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck,
+ byFBOption);
+
+ /* Get CTSDuration_ba_f1 */
+ buf->cts_duration_ba_f1 =
+ s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F1,
+ cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck,
+ byFBOption);

- buf->cts_duration_ba_f1 = cpu_to_le16(buf->cts_duration_ba_f1);
/* Get CTS Frame body */
buf->data.duration = buf->duration_ba;

@@ -1083,11 +1103,10 @@ s_vFillCTSHead(

/* Get CTSDuration_ba */
buf->duration_ba =
- cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength,
- byPktType, wCurrentRate, bNeedAck,
- byFBOption));
-
- buf->duration_ba = cpu_to_le16(buf->duration_ba);
+ s_uGetRTSCTSDuration(pDevice, CTSDUR_BA,
+ cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck,
+ byFBOption);

/* Get CTS Frame body */
buf->data.duration = buf->duration_ba;
--
1.9.1


2014-08-30 21:26:48

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 14/23] staging: vt6655: Replace typedef struct tagSCTSData with ieee80211_cts data

ieee80211_cts data needs extra padding with reserved2 set to 0

use IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS to set frame_control

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/desc.h | 14 ++++----------
drivers/staging/vt6655/rxtx.c | 26 +++++++++++++++++---------
2 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 3ce5fe8..00c3922 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -403,19 +403,12 @@ typedef const SRTS_a_FB *PCSRTS_a_FB;
//
// CTS buffer header
//
-typedef struct tagSCTSData {
- unsigned short wFrameControl;
- unsigned short wDurationID;
- unsigned char abyRA[ETH_ALEN];
- unsigned short wReserved;
-} __attribute__ ((__packed__))
-SCTSData, *PSCTSData;
-
typedef struct tagSCTS {
struct vnt_phy_field b;
unsigned short wDuration_ba;
unsigned short wReserved;
- SCTSData Data;
+ struct ieee80211_cts data;
+ u16 reserved2;
} __attribute__ ((__packed__))
SCTS, *PSCTS;
typedef const SCTS *PCSCTS;
@@ -426,7 +419,8 @@ typedef struct tagSCTS_FB {
unsigned short wReserved;
unsigned short wCTSDuration_ba_f0;
unsigned short wCTSDuration_ba_f1;
- SCTSData Data;
+ struct ieee80211_cts data;
+ u16 reserved2;
} __attribute__ ((__packed__))
SCTS_FB, *PSCTS_FB;
typedef const SCTS_FB *PCSCTS_FB;
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 208643e..d94d496 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -1016,11 +1016,15 @@ s_vFillCTSHead(
pBuf->wCTSDuration_ba_f1 = (unsigned short)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);
+ /* Get CTS Frame body */
+ pBuf->data.duration = pBuf->wDuration_ba;
+
+ pBuf->data.frame_control =
+ cpu_to_le16(IEEE80211_FTYPE_CTL |
+ IEEE80211_STYPE_CTS);
+
+ pBuf->reserved2 = 0x0;
+ memcpy(&pBuf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN);

} else { //if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA)
PSCTS pBuf = (PSCTS)pvCTS;
@@ -1035,10 +1039,14 @@ s_vFillCTSHead(
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);
+ pBuf->data.duration = pBuf->wDuration_ba;
+
+ pBuf->data.frame_control =
+ cpu_to_le16(IEEE80211_FTYPE_CTL |
+ IEEE80211_STYPE_CTS);
+
+ pBuf->reserved2 = 0x0;
+ memcpy(&pBuf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN);
}
}
}
--
1.9.1


2014-08-30 21:26:56

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 19/23] staging: vt6655: replace typedef struct tagSCTS with struct vnt_cts

Replacing members
b, wDuration_ba, wReserved, data and reserved2
with
b, duration_ba, reserved, data and reserved2

unsigned short is replaced with u16 or __le16 where necessary.

cast void pointer to pvCTS

Creating the new structure in rxtx.h

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/desc.h | 10 ----------
drivers/staging/vt6655/rxtx.c | 46 +++++++++++++++++++++++--------------------
drivers/staging/vt6655/rxtx.h | 9 +++++++++
3 files changed, 34 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index f0a31a8..4d9027e 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -355,16 +355,6 @@ union vnt_phy_field_swap {
//
// CTS buffer header
//
-typedef struct tagSCTS {
- struct vnt_phy_field b;
- unsigned short wDuration_ba;
- unsigned short wReserved;
- struct ieee80211_cts data;
- u16 reserved2;
-} __attribute__ ((__packed__))
-SCTS, *PSCTS;
-typedef const SCTS *PCSCTS;
-
typedef struct tagSCTS_FB {
struct vnt_phy_field b;
unsigned short wDuration_ba;
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 0721fbb..d3de73c 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -1071,26 +1071,29 @@ s_vFillCTSHead(
memcpy(&pBuf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN);

} else { //if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA)
- PSCTS pBuf = (PSCTS)pvCTS;
+ struct vnt_cts *buf = pvCTS;
/* Get SignalField, ServiceField & Length */
vnt_get_phy_field(pDevice, uCTSFrameLen,
pDevice->byTopCCKBasicRate,
- PK_TYPE_11B, &pBuf->b);
+ PK_TYPE_11B, &buf->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;
- pBuf->wDuration_ba = cpu_to_le16(pBuf->wDuration_ba);
+ /* Get CTSDuration_ba */
+ buf->duration_ba =
+ cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength,
+ byPktType, wCurrentRate, bNeedAck,
+ byFBOption));
+ buf->duration_ba += pDevice->wCTSDuration;
+ buf->duration_ba = cpu_to_le16(buf->duration_ba);

- //Get CTS Frame body
- pBuf->data.duration = pBuf->wDuration_ba;
+ /* Get CTS Frame body */
+ buf->data.duration = buf->duration_ba;

- pBuf->data.frame_control =
+ buf->data.frame_control =
cpu_to_le16(IEEE80211_FTYPE_CTL |
IEEE80211_STYPE_CTS);

- pBuf->reserved2 = 0x0;
- memcpy(&pBuf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN);
+ buf->reserved2 = 0x0;
+ memcpy(&buf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN);
}
}
}
@@ -1390,10 +1393,11 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts));
pvRTS = NULL;
- pvCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR);
- pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(SCTS));
+ pvCTS = (void *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR);
+ pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(struct vnt_cts));
cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
- cbMICHDR + sizeof(SCTS) + sizeof(struct vnt_tx_datahead_g);
+ cbMICHDR + sizeof(struct vnt_cts) + sizeof(struct vnt_tx_datahead_g);
}
} else {
// Auto Fall Back
@@ -2126,7 +2130,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, PSTxMgmtPacket pPacket)
unsigned char byPktType;
unsigned char *pbyTxBufferAddr;
void *pvRTS;
- PSCTS pCTS;
+ struct vnt_cts *pCTS;
void *pvTxDataHd;
unsigned int uDuration;
unsigned int cbReqCount;
@@ -2264,12 +2268,12 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, PSTxMgmtPacket pPacket)
pvRrvTime = (void *) (pbyTxBufferAddr + wTxBufSize);
pMICHDR = NULL;
pvRTS = NULL;
- pCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize +
+ pCTS = (struct vnt_cts *)(pbyTxBufferAddr + wTxBufSize +
sizeof(struct vnt_rrv_time_cts));
pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize +
- sizeof(struct vnt_rrv_time_cts) + sizeof(SCTS));
+ sizeof(struct vnt_rrv_time_cts) + sizeof(struct vnt_cts));
cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
- sizeof(SCTS) + sizeof(struct vnt_tx_datahead_g);
+ sizeof(struct vnt_cts) + sizeof(struct vnt_tx_datahead_g);
} else { // 802.11a/b packet
pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
pMICHDR = NULL;
@@ -2754,12 +2758,12 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb,
pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize +
sizeof(struct vnt_rrv_time_cts));
pvRTS = NULL;
- pvCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize +
+ pvCTS = (struct vnt_cts *)(pbyTxBufferAddr + wTxBufSize +
sizeof(struct vnt_rrv_time_cts) + cbMICHDR);
pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize +
- sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(SCTS));
+ sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(struct vnt_cts));
cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
- cbMICHDR + sizeof(SCTS) + sizeof(struct vnt_tx_datahead_g);
+ cbMICHDR + sizeof(struct vnt_cts) + sizeof(struct vnt_tx_datahead_g);

} else {//802.11a/b packet

diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h
index bac2214..2c09c11 100644
--- a/drivers/staging/vt6655/rxtx.h
+++ b/drivers/staging/vt6655/rxtx.h
@@ -154,6 +154,15 @@ struct vnt_rts_a_fb {
struct ieee80211_rts data;
} __packed;

+/* CTS buffer header */
+struct vnt_cts {
+ struct vnt_phy_field b;
+ __le16 duration_ba;
+ u16 reserved;
+ struct ieee80211_cts data;
+ u16 reserved2;
+} __packed;
+
struct vnt_tx_short_buf_head {
__le16 fifo_ctl;
u16 time_stamp;
--
1.9.1


2014-08-30 21:26:43

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 12/23] staging: vt6655: Fix *Duration s_uFillDataHead to return to __le16

All callers should be __le16.

Fix vGenerateMACHeader duration to __le16 and reverse the endian
conversion.

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

diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index bd0e339..0171f64 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -166,7 +166,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
unsigned int uNodeIndex, unsigned int *puMACfragNum);

static
-unsigned int
+__le16
s_uFillDataHead(
struct vnt_private *pDevice,
unsigned char byPktType,
@@ -671,7 +671,7 @@ s_uGetRTSCTSDuration(
}

static
-unsigned int
+__le16
s_uFillDataHead(
struct vnt_private *pDevice,
unsigned char byPktType,
@@ -1202,7 +1202,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
unsigned char *pbyIVHead;
unsigned char *pbyMacHdr;
unsigned short wFragType; //00:Non-Frag, 01:Start, 10:Mid, 11:Last
- unsigned int uDuration;
+ __le16 uDuration;
unsigned char *pbyBuffer;
unsigned int cbIVlen = 0;
unsigned int cbICVlen = 0;
@@ -1448,7 +1448,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbFragmentSize, uDMAIdx, bNeedACK,
uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate);
// Generate TX MAC Header
- vGenerateMACHeader(pDevice, pbyMacHdr, (unsigned short)uDuration, psEthHeader, bNeedEncrypt,
+ vGenerateMACHeader(pDevice, pbyMacHdr, uDuration, psEthHeader, bNeedEncrypt,
wFragType, uDMAIdx, uFragIdx);

if (bNeedEncrypt == true) {
@@ -1539,7 +1539,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate);

// Generate TX MAC Header
- vGenerateMACHeader(pDevice, pbyMacHdr, (unsigned short)uDuration, psEthHeader, bNeedEncrypt,
+ vGenerateMACHeader(pDevice, pbyMacHdr, uDuration, psEthHeader, bNeedEncrypt,
wFragType, uDMAIdx, uFragIdx);

if (bNeedEncrypt == true) {
@@ -1657,7 +1657,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate);

// Generate TX MAC Header
- vGenerateMACHeader(pDevice, pbyMacHdr, (unsigned short)uDuration, psEthHeader, bNeedEncrypt,
+ vGenerateMACHeader(pDevice, pbyMacHdr, uDuration, psEthHeader, bNeedEncrypt,
wFragType, uDMAIdx, uFragIdx);

if (bNeedEncrypt == true) {
@@ -1765,7 +1765,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
0, 0, uMACfragNum, byFBOption, pDevice->wCurrentRate);

// Generate TX MAC Header
- vGenerateMACHeader(pDevice, pbyMacHdr, (unsigned short)uDuration, psEthHeader, bNeedEncrypt,
+ vGenerateMACHeader(pDevice, pbyMacHdr, uDuration, psEthHeader, bNeedEncrypt,
wFragType, uDMAIdx, 0);

if (bNeedEncrypt == true) {
@@ -1989,7 +1989,7 @@ void
vGenerateMACHeader(
struct vnt_private *pDevice,
unsigned char *pbyBufferAddr,
- unsigned short wDuration,
+ __le16 wDuration,
PSEthernetHeader psEthHeader,
bool bNeedEncrypt,
unsigned short wFragType,
@@ -2027,7 +2027,7 @@ vGenerateMACHeader(
if (bNeedEncrypt)
pMACHeader->wFrameCtl |= cpu_to_le16((unsigned short)WLAN_SET_FC_ISWEP(1));

- pMACHeader->wDurationID = cpu_to_le16(wDuration);
+ pMACHeader->wDurationID = le16_to_cpu(wDuration);

if (pDevice->bLongHeader) {
PWLAN_80211HDR_A4 pMACA4Header = (PWLAN_80211HDR_A4) pbyBufferAddr;
--
1.9.1


2014-08-30 21:26:33

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 06/23] staging: vt6655: s_vGenerateTxParameter removed nested pvRrvTime NULL check

Just do single NULL check on pvRrvTime and return.

If pvRrvTime is NULL none of the if statements are valid.

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

diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index ee20ae2..afdf3ab 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -1084,71 +1084,58 @@ s_vGenerateTxParameter(
if (pDevice->bLongHeader)
cbMACHdLen = WLAN_HDR_ADDR3_LEN + 6;

+ if (!pvRrvTime)
+ return;
+
if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
if (pvRTS != NULL) { //RTS_need
- //Fill RsvTime
- if (pvRrvTime) {
- struct vnt_rrv_time_rts *buf = pvRrvTime;
-
- buf->rts_rrv_time_aa = s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate);
- buf->rts_rrv_time_ba = s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate);
- buf->rts_rrv_time_bb = s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate);
- buf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);
- buf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK);
- }
- //Fill RTS
+ /* Fill RsvTime */
+ struct vnt_rrv_time_rts *buf = pvRrvTime;
+
+ buf->rts_rrv_time_aa = s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate);
+ buf->rts_rrv_time_ba = s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate);
+ buf->rts_rrv_time_bb = s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate);
+ buf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);
+ buf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK);
+
s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
} else {//RTS_needless, PCF mode
+ struct vnt_rrv_time_cts *buf = pvRrvTime;

- //Fill RsvTime
- if (pvRrvTime) {
- struct vnt_rrv_time_cts *buf = pvRrvTime;
-
- buf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);
- buf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK);
- buf->cts_rrv_time_ba = s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate);
- }
+ buf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);
+ buf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK);
+ buf->cts_rrv_time_ba = s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate);

//Fill CTS
s_vFillCTSHead(pDevice, uDMAIdx, byPktType, pvCTS, cbFrameSize, bNeedACK, bDisCRC, wCurrentRate, byFBOption);
}
} else if (byPktType == PK_TYPE_11A) {
if (pvRTS != NULL) {//RTS_need, non PCF mode
- //Fill RsvTime
- if (pvRrvTime) {
- struct vnt_rrv_time_ab *buf = pvRrvTime;
+ struct vnt_rrv_time_ab *buf = pvRrvTime;
+
+ buf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate);
+ buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);

- buf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate);
- buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);
- }
//Fill RTS
s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
} else if (pvRTS == NULL) {//RTS_needless, non PCF mode
- //Fill RsvTime
- if (pvRrvTime) {
- struct vnt_rrv_time_ab *buf = pvRrvTime;
+ struct vnt_rrv_time_ab *buf = pvRrvTime;

- buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11A, cbFrameSize, wCurrentRate, bNeedACK);
- }
+ buf->rrv_time = 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
- //Fill RsvTime
- if (pvRrvTime) {
- struct vnt_rrv_time_ab *buf = pvRrvTime;
+ struct vnt_rrv_time_ab *buf = pvRrvTime;
+
+ buf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate);
+ buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK);

- buf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate);
- buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK);
- }
//Fill RTS
s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
} else { //RTS_needless, non PCF mode
- //Fill RsvTime
- if (pvRrvTime) {
- struct vnt_rrv_time_ab *buf = pvRrvTime;
+ struct vnt_rrv_time_ab *buf = pvRrvTime;

- buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK);
- }
+ buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK);
}
}
}
--
1.9.1


2014-08-30 21:26:46

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 13/23] staging: vt6655: Replace typedef struct tagSRTSData with ieee80211_rts data

Replacing SRTSData Data with struct ieee80211_rts data

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

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 0da860e..3ce5fe8 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -33,6 +33,7 @@

#include <linux/types.h>
#include <linux/mm.h>
+#include "linux/ieee80211.h"
#include "ttype.h"
#include "tether.h"

@@ -338,18 +339,6 @@ typedef struct tagSRrvTime_atim {
SRrvTime_atim, *PSRrvTime_atim;
typedef const SRrvTime_atim *PCSRrvTime_atim;

-//
-// RTS buffer header
-//
-typedef struct tagSRTSData {
- unsigned short wFrameControl;
- unsigned short wDurationID;
- unsigned char abyRA[ETH_ALEN];
- unsigned char abyTA[ETH_ALEN];
-} __attribute__ ((__packed__))
-SRTSData, *PSRTSData;
-typedef const SRTSData *PCSRTSData;
-
/* Length, Service, and Signal fields of Phy for Tx */
struct vnt_phy_field {
u8 signal;
@@ -370,7 +359,7 @@ typedef struct tagSRTS_g {
unsigned short wDuration_aa;
unsigned short wDuration_bb;
unsigned short wReserved;
- SRTSData Data;
+ struct ieee80211_rts data;
} __attribute__ ((__packed__))
SRTS_g, *PSRTS_g;
typedef const SRTS_g *PCSRTS_g;
@@ -386,7 +375,7 @@ typedef struct tagSRTS_g_FB {
unsigned short wRTSDuration_aa_f0;
unsigned short wRTSDuration_ba_f1;
unsigned short wRTSDuration_aa_f1;
- SRTSData Data;
+ struct ieee80211_rts data;
} __attribute__ ((__packed__))
SRTS_g_FB, *PSRTS_g_FB;
typedef const SRTS_g_FB *PCSRTS_g_FB;
@@ -395,7 +384,7 @@ typedef struct tagSRTS_ab {
struct vnt_phy_field ab;
unsigned short wDuration;
unsigned short wReserved;
- SRTSData Data;
+ struct ieee80211_rts data;
} __attribute__ ((__packed__))
SRTS_ab, *PSRTS_ab;
typedef const SRTS_ab *PCSRTS_ab;
@@ -406,7 +395,7 @@ typedef struct tagSRTS_a_FB {
unsigned short wReserved;
unsigned short wRTSDuration_f0;
unsigned short wRTSDuration_f1;
- SRTSData Data;
+ struct ieee80211_rts data;
} __attribute__ ((__packed__))
SRTS_a_FB, *PSRTS_a_FB;
typedef const SRTS_a_FB *PCSRTS_a_FB;
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 0171f64..208643e 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -832,19 +832,23 @@ s_vFillRTSHead(
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
pBuf->wDuration_ba = cpu_to_le16((unsigned short)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
+ pBuf->data.duration = pBuf->wDuration_aa;
+ /* Get RTS Frame body */
+ pBuf->data.frame_control =
+ cpu_to_le16(IEEE80211_FTYPE_CTL |
+ IEEE80211_STYPE_RTS);
+
+
if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
} else {
- memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ra, pDevice->abyBSSID, ETH_ALEN);
}
if (pDevice->eOPMode == OP_MODE_AP)
- memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ta, pDevice->abyBSSID, ETH_ALEN);
else
- memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);

} else {
PSRTS_g_FB pBuf = (PSRTS_g_FB)pvRTS;
@@ -864,21 +868,24 @@ s_vFillRTSHead(
pBuf->wRTSDuration_aa_f0 = cpu_to_le16((unsigned short)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((unsigned short)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((unsigned short)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
+ pBuf->data.duration = pBuf->wDuration_aa;
+ /* Get RTS Frame body */
+ pBuf->data.frame_control =
+ cpu_to_le16(IEEE80211_FTYPE_CTL |
+ IEEE80211_STYPE_RTS);
+

if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
} else {
- memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ra, pDevice->abyBSSID, ETH_ALEN);
}

if (pDevice->eOPMode == OP_MODE_AP)
- memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ta, pDevice->abyBSSID, ETH_ALEN);
else
- memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);

} // if (byFBOption == AUTO_FB_NONE)
} else if (byPktType == PK_TYPE_11A) {
@@ -890,21 +897,24 @@ s_vFillRTSHead(
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;
- //Get RTS Frame body
- pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
+ pBuf->data.duration = pBuf->wDuration;
+ /* Get RTS Frame body */
+ pBuf->data.frame_control =
+ cpu_to_le16(IEEE80211_FTYPE_CTL |
+ IEEE80211_STYPE_RTS);
+

if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
} else {
- memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ra, pDevice->abyBSSID, ETH_ALEN);
}

if (pDevice->eOPMode == OP_MODE_AP)
- memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ta, pDevice->abyBSSID, ETH_ALEN);
else
- memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);

} else {
PSRTS_a_FB pBuf = (PSRTS_a_FB)pvRTS;
@@ -916,20 +926,23 @@ s_vFillRTSHead(
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
pBuf->wRTSDuration_f1 = cpu_to_le16((unsigned short)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
+ pBuf->data.duration = pBuf->wDuration;
+ /* Get RTS Frame body */
+ pBuf->data.frame_control =
+ cpu_to_le16(IEEE80211_FTYPE_CTL |
+ IEEE80211_STYPE_RTS);
+

if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
} else {
- memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ra, pDevice->abyBSSID, ETH_ALEN);
}
if (pDevice->eOPMode == OP_MODE_AP)
- memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ta, pDevice->abyBSSID, ETH_ALEN);
else
- memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);
}
} else if (byPktType == PK_TYPE_11B) {
PSRTS_ab pBuf = (PSRTS_ab)pvRTS;
@@ -939,21 +952,22 @@ s_vFillRTSHead(
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;
- //Get RTS Frame body
- pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
+ pBuf->data.duration = pBuf->wDuration;
+ /* Get RTS Frame body */
+ pBuf->data.frame_control =
+ cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS);

if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
} else {
- memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ra, pDevice->abyBSSID, ETH_ALEN);
}

if (pDevice->eOPMode == OP_MODE_AP)
- memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ta, pDevice->abyBSSID, ETH_ALEN);
else
- memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
+ memcpy(&pBuf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);
}
}

--
1.9.1


2014-08-30 21:26:37

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 08/23] staging: vt6655: replace typedef struct tagSTxDataHead_g with struct vnt_tx_datahead_g

Replace members
b, a, wDuration_b, wDuration_a, wTimeStampOff_b and wTimeStampOff_a
with
b, a, duration_b, duration_a, time_stamp_off_b and time_stamp_off_a

Using __le16 endian type for unsigned short.

Creating the new structure in rxtx.h

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/desc.h | 11 --------
drivers/staging/vt6655/rxtx.c | 62 ++++++++++++++++++++++---------------------
drivers/staging/vt6655/rxtx.h | 10 +++++++
3 files changed, 42 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 84de4ef..27b6fd7 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -459,17 +459,6 @@ typedef const STxBufHead *PCSTxBufHead;
//
// Tx data header
//
-typedef struct tagSTxDataHead_g {
- struct vnt_phy_field b;
- struct vnt_phy_field a;
- unsigned short wDuration_b;
- unsigned short wDuration_a;
- unsigned short wTimeStampOff_b;
- unsigned short wTimeStampOff_a;
-} __attribute__ ((__packed__))
-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;
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 9617701..97b84df 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -693,29 +693,29 @@ s_uFillDataHead(

if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
if (byFBOption == AUTO_FB_NONE) {
- PSTxDataHead_g pBuf = (PSTxDataHead_g)pTxDataHead;
+ struct vnt_tx_datahead_g *buf = pTxDataHead;
/* Get SignalField, ServiceField & Length */
vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate,
- byPktType, &pBuf->a);
+ byPktType, &buf->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
- pBuf->wDuration_b = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength,
- PK_TYPE_11B, pDevice->byTopCCKBasicRate,
- bNeedAck, uFragIdx, cbLastFragmentSize,
- uMACfragNum, byFBOption)); //1: 2.4
-
- pBuf->wTimeStampOff_a = vnt_time_stamp_off(pDevice, wCurrentRate);
- pBuf->wTimeStampOff_b = vnt_time_stamp_off(pDevice, pDevice->byTopCCKBasicRate);
-
- return pBuf->wDuration_a;
+ PK_TYPE_11B, &buf->b);
+
+ /* Get Duration and TimeStamp */
+ buf->duration_a = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength,
+ byPktType, wCurrentRate, bNeedAck, uFragIdx,
+ cbLastFragmentSize, uMACfragNum,
+ byFBOption));
+ buf->duration_b = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength,
+ PK_TYPE_11B, pDevice->byTopCCKBasicRate,
+ bNeedAck, uFragIdx, cbLastFragmentSize,
+ uMACfragNum, byFBOption));
+
+ buf->time_stamp_off_a = vnt_time_stamp_off(pDevice, wCurrentRate);
+ buf->time_stamp_off_b = vnt_time_stamp_off(pDevice, pDevice->byTopCCKBasicRate);
+
+ return buf->duration_a;
} else {
// Auto Fallback
PSTxDataHead_g_FB pBuf = (PSTxDataHead_g_FB)pTxDataHead;
@@ -1316,15 +1316,17 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts));
pvRTS = (PSRTS_g)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR);
pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_g)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(SRTS_g));
- cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(SRTS_g) + sizeof(STxDataHead_g);
+ pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(SRTS_g));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) +
+ cbMICHDR + sizeof(SRTS_g) + sizeof(struct vnt_tx_datahead_g);
} else { //RTS_needless
pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts));
pvRTS = NULL;
pvCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR);
- pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(SCTS));
- cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(SCTS) + sizeof(STxDataHead_g);
+ pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(SCTS));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
+ cbMICHDR + sizeof(SCTS) + sizeof(struct vnt_tx_datahead_g);
}
} else {
// Auto Fall Back
@@ -2188,10 +2190,10 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, PSTxMgmtPacket pPacket)
pvRTS = NULL;
pCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize +
sizeof(struct vnt_rrv_time_cts));
- pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize +
+ pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize +
sizeof(struct vnt_rrv_time_cts) + sizeof(SCTS));
cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
- sizeof(SCTS) + sizeof(STxDataHead_g);
+ sizeof(SCTS) + sizeof(struct vnt_tx_datahead_g);
} else { // 802.11a/b packet
pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
pMICHDR = NULL;
@@ -2290,8 +2292,8 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, PSTxMgmtPacket pPacket)
// 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);
+ ((struct vnt_tx_datahead_g *)pvTxDataHd)->duration_a = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
+ ((struct vnt_tx_datahead_g *)pvTxDataHd)->duration_b = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
} else {
((PSTxDataHead_ab)pvTxDataHd)->wDuration = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
}
@@ -2676,10 +2678,10 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb,
pvRTS = NULL;
pvCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize +
sizeof(struct vnt_rrv_time_cts) + cbMICHDR);
- pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize +
+ pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize +
sizeof(struct vnt_rrv_time_cts) + cbMICHDR + sizeof(SCTS));
cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
- cbMICHDR + sizeof(SCTS) + sizeof(STxDataHead_g);
+ cbMICHDR + sizeof(SCTS) + sizeof(struct vnt_tx_datahead_g);

} else {//802.11a/b packet

@@ -2816,8 +2818,8 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb,
// 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);
+ ((struct vnt_tx_datahead_g *)pvTxDataHd)->duration_a = cpu_to_le16(p80211Header->sA2.wDurationID);
+ ((struct vnt_tx_datahead_g *)pvTxDataHd)->duration_b = cpu_to_le16(p80211Header->sA2.wDurationID);
} else {
((PSTxDataHead_ab)pvTxDataHd)->wDuration = cpu_to_le16(p80211Header->sA2.wDurationID);
}
diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h
index a14b5f1..0fe9998 100644
--- a/drivers/staging/vt6655/rxtx.h
+++ b/drivers/staging/vt6655/rxtx.h
@@ -78,6 +78,16 @@ struct vnt_rrv_time_ab {
__le16 rrv_time;
} __packed;

+/* TX data header */
+struct vnt_tx_datahead_g {
+ struct vnt_phy_field b;
+ struct vnt_phy_field a;
+ __le16 duration_b;
+ __le16 duration_a;
+ __le16 time_stamp_off_b;
+ __le16 time_stamp_off_a;
+} __packed;
+
struct vnt_tx_short_buf_head {
__le16 fifo_ctl;
u16 time_stamp;
--
1.9.1


2014-08-30 21:26:28

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 03/23] staging: vt6655: rxtx replace typedef struct tagSRrvTime_ab with struct vnt_rrv_time_ab

Replacing members
wRTSTxRrvTime and wTxRrvTime
with
rts_rrv_time and rrv_time

using __le16 type

Moving structure to rxtx.h

pvRrvTime is a void pointer

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/desc.h | 7 -----
drivers/staging/vt6655/rxtx.c | 73 ++++++++++++++++++++++---------------------
drivers/staging/vt6655/rxtx.h | 5 +++
3 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 237a99c..84de4ef 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -331,13 +331,6 @@ typedef const STxSyncDesc *PCSTxSyncDesc;
//
// RsvTime buffer header
//
-typedef struct tagSRrvTime_ab {
- unsigned short wRTSTxRrvTime;
- unsigned short wTxRrvTime;
-} __attribute__ ((__packed__))
-SRrvTime_ab, *PSRrvTime_ab;
-typedef const SRrvTime_ab *PCSRrvTime_ab;
-
typedef struct tagSRrvTime_atim {
unsigned short wCTSTxRrvTime_ba;
unsigned short wTxRrvTime_a;
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index b2fd513..a0b8384 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -1109,38 +1109,38 @@ s_vGenerateTxParameter(
if (pvRTS != NULL) {//RTS_need, non PCF mode
//Fill RsvTime
if (pvRrvTime) {
- PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
+ struct vnt_rrv_time_ab *buf = pvRrvTime;

- pBuf->wRTSTxRrvTime = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 0:5GHz
- pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//0:OFDM
+ buf->rts_rrv_time = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));
+ buf->rrv_time = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));
}
//Fill RTS
s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
} else if (pvRTS == NULL) {//RTS_needless, non PCF mode
//Fill RsvTime
if (pvRrvTime) {
- PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
+ struct vnt_rrv_time_ab *buf = pvRrvTime;

- pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11A, cbFrameSize, wCurrentRate, bNeedACK)); //0:OFDM
+ buf->rrv_time = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11A, cbFrameSize, wCurrentRate, bNeedACK));
}
}
} else if (byPktType == PK_TYPE_11B) {
if ((pvRTS != NULL)) {//RTS_need, non PCF mode
//Fill RsvTime
if (pvRrvTime) {
- PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
+ struct vnt_rrv_time_ab *buf = pvRrvTime;

- pBuf->wRTSTxRrvTime = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz
- pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK));//1:CCK
+ buf->rts_rrv_time = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));
+ buf->rrv_time = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK));
}
//Fill RTS
s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
} else { //RTS_needless, non PCF mode
//Fill RsvTime
if (pvRrvTime) {
- PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
+ struct vnt_rrv_time_ab *buf = pvRrvTime;

- pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK)); //1:CCK
+ buf->rrv_time = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK));
}
}
}
@@ -1348,36 +1348,36 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,

if (byFBOption == AUTO_FB_NONE) {
if (bRTS == true) {
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- pvRTS = (PSRTS_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
+ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
+ pvRTS = (PSRTS_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab));
- cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab) + sizeof(STxDataHead_ab);
+ pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(SRTS_ab));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(SRTS_ab) + sizeof(STxDataHead_ab);
} else { //RTS_needless, need MICHDR
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
+ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
pvRTS = NULL;
pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_ab);
+ pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(STxDataHead_ab);
}
} else {
// Auto Fall Back
if (bRTS == true) {//RTS_need
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- pvRTS = (PSRTS_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
+ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
+ pvRTS = (PSRTS_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB));
- cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB) + sizeof(STxDataHead_a_FB);
+ pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(SRTS_a_FB));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(SRTS_a_FB) + sizeof(STxDataHead_a_FB);
} else { //RTS_needless
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
+ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_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);
+ pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(STxDataHead_a_FB);
}
} // Auto Fall Back
}
@@ -2193,12 +2193,12 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, PSTxMgmtPacket pPacket)
cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
sizeof(SCTS) + sizeof(STxDataHead_g);
} else { // 802.11a/b packet
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
+ pvRrvTime = (void *)(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 = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
+ cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + sizeof(STxDataHead_ab);
}

memset((void *)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderSize - wTxBufSize));
@@ -2683,12 +2683,15 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb,

} else {//802.11a/b packet

- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
+ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr +
+ wTxBufSize + sizeof(struct vnt_rrv_time_ab));
pvRTS = NULL;
pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
- cbHeaderSize = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_ab);
+ pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr +
+ wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
+ cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_ab) +
+ cbMICHDR + sizeof(STxDataHead_ab);

}

diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h
index 4dca615..a14b5f1 100644
--- a/drivers/staging/vt6655/rxtx.h
+++ b/drivers/staging/vt6655/rxtx.h
@@ -73,6 +73,11 @@ struct vnt_rrv_time_cts {
__le16 rrv_time_a;
} __packed;

+struct vnt_rrv_time_ab {
+ __le16 rts_rrv_time;
+ __le16 rrv_time;
+} __packed;
+
struct vnt_tx_short_buf_head {
__le16 fifo_ctl;
u16 time_stamp;
--
1.9.1


2014-08-30 21:26:51

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 16/23] staging: vt6655: replace typedef struct tagSRTS_g_FB with struct vnt_rts_g_fb

Replacing members
b, a, wDuration_ba, wDuration_aa, wDuration_bb, wReserved, wRTSDuration_ba_f0,
wRTSDuration_aa_f0, wRTSDuration_ba_f1, wRTSDuration_aa_f1 and data

with

b, a, duration_ba, duration_aa, duration_bb, wReserved, rts_duration_ba_f0,
rts_duration_aa_f0, rts_duration_ba_f1, rts_duration_aa_f1 and data

replacing unsigned short with u16 or __le16 where endian correction is necessary.

Creating the new structure in rxtx.h

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/desc.h | 16 -----------
drivers/staging/vt6655/rxtx.c | 62 +++++++++++++++++++++++++++++--------------
drivers/staging/vt6655/rxtx.h | 14 ++++++++++
3 files changed, 56 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 5fbef74..e1c686e 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -352,22 +352,6 @@ union vnt_phy_field_swap {
u32 field_write;
};

-typedef struct tagSRTS_g_FB {
- struct vnt_phy_field b;
- struct vnt_phy_field a;
- unsigned short wDuration_ba;
- unsigned short wDuration_aa;
- unsigned short wDuration_bb;
- unsigned short wReserved;
- unsigned short wRTSDuration_ba_f0;
- unsigned short wRTSDuration_aa_f0;
- unsigned short wRTSDuration_ba_f1;
- unsigned short wRTSDuration_aa_f1;
- struct ieee80211_rts data;
-} __attribute__ ((__packed__))
-SRTS_g_FB, *PSRTS_g_FB;
-typedef const SRTS_g_FB *PCSRTS_g_FB;
-
typedef struct tagSRTS_ab {
struct vnt_phy_field ab;
unsigned short wDuration;
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 29a4ed0..a0d379a 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -860,41 +860,62 @@ s_vFillRTSHead(
memcpy(&buf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);

} else {
- PSRTS_g_FB pBuf = (PSRTS_g_FB)pvRTS;
+ struct vnt_rts_g_fb *buf = pvRTS;
/* Get SignalField, ServiceField & Length */
vnt_get_phy_field(pDevice, uRTSFrameLen,
pDevice->byTopCCKBasicRate,
- PK_TYPE_11B, &pBuf->b);
+ PK_TYPE_11B, &buf->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
- pBuf->wDuration_ba = cpu_to_le16((unsigned short)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((unsigned short)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((unsigned short)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((unsigned short)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((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //7:wRTSDuration_aa_f1, 1:2.4G, 1:CCKData
- pBuf->data.duration = pBuf->wDuration_aa;
+ byPktType, &buf->a);
+ /* Get Duration */
+ buf->duration_bb =
+ cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength,
+ PK_TYPE_11B, pDevice->byTopCCKBasicRate,
+ bNeedAck, byFBOption));
+ buf->duration_aa =
+ cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength,
+ byPktType, wCurrentRate, bNeedAck,
+ byFBOption));
+ buf->duration_ba =
+ cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength,
+ byPktType, wCurrentRate, bNeedAck,
+ byFBOption));
+ buf->rts_duration_ba_f0 =
+ cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F0, cbFrameLength,
+ byPktType, wCurrentRate, bNeedAck,
+ byFBOption));
+ buf->rts_duration_aa_f0 =
+ cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength,
+ byPktType, wCurrentRate, bNeedAck,
+ byFBOption));
+ buf->rts_duration_ba_f1 =
+ cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F1, cbFrameLength,
+ byPktType, wCurrentRate, bNeedAck,
+ byFBOption));
+ buf->rts_duration_aa_f1 =
+ cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength,
+ byPktType, wCurrentRate, bNeedAck,
+ byFBOption));
+ buf->data.duration = buf->duration_aa;
/* Get RTS Frame body */
- pBuf->data.frame_control =
+ buf->data.frame_control =
cpu_to_le16(IEEE80211_FTYPE_CTL |
IEEE80211_STYPE_RTS);


if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&pBuf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
+ memcpy(&buf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
} else {
- memcpy(&pBuf->data.ra, pDevice->abyBSSID, ETH_ALEN);
+ memcpy(&buf->data.ra, pDevice->abyBSSID, ETH_ALEN);
}

if (pDevice->eOPMode == OP_MODE_AP)
- memcpy(&pBuf->data.ta, pDevice->abyBSSID, ETH_ALEN);
+ memcpy(&buf->data.ta, pDevice->abyBSSID, ETH_ALEN);
else
- memcpy(&pBuf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);
+ memcpy(&buf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);

} // if (byFBOption == AUTO_FB_NONE)
} else if (byPktType == PK_TYPE_11A) {
@@ -1365,11 +1386,12 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
if (bRTS == true) {//RTS_need
pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts));
- pvRTS = (PSRTS_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR);
+ pvRTS = (void *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR);
pvCTS = NULL;
- pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(SRTS_g_FB));
+ pvTxDataHd = (void *)(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(SRTS_g_FB) + sizeof(struct vnt_tx_datahead_g_fb);
+ cbMICHDR + sizeof(struct vnt_rts_g_fb) + sizeof(struct vnt_tx_datahead_g_fb);
} else { //RTS_needless
pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts));
diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h
index 377cd42..b9153e0 100644
--- a/drivers/staging/vt6655/rxtx.h
+++ b/drivers/staging/vt6655/rxtx.h
@@ -124,6 +124,20 @@ struct vnt_rts_g {
struct ieee80211_rts data;
} __packed;

+struct vnt_rts_g_fb {
+ struct vnt_phy_field b;
+ struct vnt_phy_field a;
+ __le16 duration_ba;
+ __le16 duration_aa;
+ __le16 duration_bb;
+ u16 wReserved;
+ __le16 rts_duration_ba_f0;
+ __le16 rts_duration_aa_f0;
+ __le16 rts_duration_ba_f1;
+ __le16 rts_duration_aa_f1;
+ struct ieee80211_rts data;
+} __packed;
+
struct vnt_tx_short_buf_head {
__le16 fifo_ctl;
u16 time_stamp;
--
1.9.1


2014-08-30 21:26:50

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 15/23] staging: vt6655: replace typedef struct tagSRTS_g with struct vnt_rts_g

Replacing members
b, a, wDuration_ba, wDuration_aa, wDuration_bb, wReserved and data
with
b, a,duration_ba, duration_aa, duration_bb, reserved and data

replacing unsigned short with u16 or __le16 where endian correction is necessary.

Creating the new structure in rxtx.h

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/desc.h | 12 ------------
drivers/staging/vt6655/rxtx.c | 45 +++++++++++++++++++++++++++----------------
drivers/staging/vt6655/rxtx.h | 11 +++++++++++
3 files changed, 39 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 00c3922..5fbef74 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -352,18 +352,6 @@ union vnt_phy_field_swap {
u32 field_write;
};

-typedef struct tagSRTS_g {
- struct vnt_phy_field b;
- struct vnt_phy_field a;
- unsigned short wDuration_ba;
- unsigned short wDuration_aa;
- unsigned short wDuration_bb;
- unsigned short wReserved;
- struct ieee80211_rts data;
-} __attribute__ ((__packed__))
-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;
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index d94d496..29a4ed0 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -818,37 +818,46 @@ s_vFillRTSHead(
// Otherwise, we need to modify codes for them.
if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
if (byFBOption == AUTO_FB_NONE) {
- PSRTS_g pBuf = (PSRTS_g)pvRTS;
+ struct vnt_rts_g *buf = pvRTS;
/* Get SignalField, ServiceField & Length */
vnt_get_phy_field(pDevice, uRTSFrameLen,
pDevice->byTopCCKBasicRate,
- PK_TYPE_11B, &pBuf->b);
+ PK_TYPE_11B, &buf->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
- pBuf->wDuration_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data
-
- pBuf->data.duration = pBuf->wDuration_aa;
+ byPktType, &buf->a);
+ /* Get Duration */
+ buf->duration_bb =
+ cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength,
+ PK_TYPE_11B, pDevice->byTopCCKBasicRate,
+ bNeedAck, byFBOption));
+ buf->duration_aa =
+ cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength,
+ byPktType, wCurrentRate, bNeedAck,
+ byFBOption));
+ buf->duration_ba =
+ cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength,
+ byPktType, wCurrentRate, bNeedAck,
+ byFBOption));
+
+ buf->data.duration = buf->duration_aa;
/* Get RTS Frame body */
- pBuf->data.frame_control =
+ buf->data.frame_control =
cpu_to_le16(IEEE80211_FTYPE_CTL |
IEEE80211_STYPE_RTS);


if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&pBuf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
+ memcpy(&buf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
} else {
- memcpy(&pBuf->data.ra, pDevice->abyBSSID, ETH_ALEN);
+ memcpy(&buf->data.ra, pDevice->abyBSSID, ETH_ALEN);
}
if (pDevice->eOPMode == OP_MODE_AP)
- memcpy(&pBuf->data.ta, pDevice->abyBSSID, ETH_ALEN);
+ memcpy(&buf->data.ta, pDevice->abyBSSID, ETH_ALEN);
else
- memcpy(&pBuf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);
+ memcpy(&buf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);

} else {
PSRTS_g_FB pBuf = (PSRTS_g_FB)pvRTS;
@@ -1335,11 +1344,13 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
if (bRTS == true) {//RTS_need
pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts));
- pvRTS = (PSRTS_g)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR);
+ pvRTS = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR);
pvCTS = NULL;
- pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR + sizeof(SRTS_g));
+ pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) +
+ cbMICHDR + sizeof(struct vnt_rts_g));
cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) +
- cbMICHDR + sizeof(SRTS_g) + sizeof(struct vnt_tx_datahead_g);
+ cbMICHDR + sizeof(struct vnt_rts_g) +
+ sizeof(struct vnt_tx_datahead_g);
} else { //RTS_needless
pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts));
diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h
index 21bbc7e..377cd42 100644
--- a/drivers/staging/vt6655/rxtx.h
+++ b/drivers/staging/vt6655/rxtx.h
@@ -113,6 +113,17 @@ struct vnt_tx_datahead_a_fb {
__le16 duration_f1;
} __packed;

+/* RTS buffer header */
+struct vnt_rts_g {
+ struct vnt_phy_field b;
+ struct vnt_phy_field a;
+ __le16 duration_ba;
+ __le16 duration_aa;
+ __le16 duration_bb;
+ u16 reserved;
+ struct ieee80211_rts data;
+} __packed;
+
struct vnt_tx_short_buf_head {
__le16 fifo_ctl;
u16 time_stamp;
--
1.9.1


2014-08-30 21:27:04

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 23/23] staging: vt6655: Replace typedef enum _CARD_OP_MODE eOPMode with enum nl80211_iftype op_mode.

Using the nl80211 header.

Using enum changes
OP_MODE_ADHOC -> NL80211_IFTYPE_ADHOC
OP_MODE_AP -> NL80211_IFTYPE_AP
OP_MODE_INFRASTRUCTURE -> NL80211_IFTYPE_STATION
OP_MODE_UNKNOWN -> NL80211_IFTYPE_UNSPECIFIED

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/card.c | 12 ++++-----
drivers/staging/vt6655/card.h | 10 ++------
drivers/staging/vt6655/device.h | 2 +-
drivers/staging/vt6655/device_main.c | 14 +++++-----
drivers/staging/vt6655/dpc.c | 2 +-
drivers/staging/vt6655/iwctl.c | 2 +-
drivers/staging/vt6655/power.c | 7 ++---
drivers/staging/vt6655/rxtx.c | 50 ++++++++++++++++++------------------
drivers/staging/vt6655/wcmd.c | 12 ++++-----
drivers/staging/vt6655/wmgr.c | 8 +++---
10 files changed, 57 insertions(+), 62 deletions(-)

diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index c4ed8d5..5a69502 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -698,7 +698,7 @@ bool CARDbStartTxPacket(struct vnt_private *pDevice, CARD_PKT_TYPE ePktType)

if ((pDevice->bStopBeacon == false) &&
(pDevice->bBeaconBufReady == true) &&
- (pDevice->eOPMode == OP_MODE_ADHOC)) {
+ (pDevice->op_mode == NL80211_IFTYPE_ADHOC)) {
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
}

@@ -720,22 +720,22 @@ bool CARDbStartTxPacket(struct vnt_private *pDevice, CARD_PKT_TYPE ePktType)
*
*/
bool CARDbSetBSSID(struct vnt_private *pDevice,
- unsigned char *pbyBSSID, CARD_OP_MODE eOPMode)
+ unsigned char *pbyBSSID, enum nl80211_iftype op_mode)
{

MACvWriteBSSIDAddress(pDevice->PortOffset, pbyBSSID);
memcpy(pDevice->abyBSSID, pbyBSSID, WLAN_BSSID_LEN);
- if (eOPMode == OP_MODE_ADHOC)
+ if (op_mode == NL80211_IFTYPE_ADHOC)
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_ADHOC);
else
MACvRegBitsOff(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_ADHOC);

- if (eOPMode == OP_MODE_AP)
+ if (op_mode == NL80211_IFTYPE_AP)
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_AP);
else
MACvRegBitsOff(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_AP);

- if (eOPMode == OP_MODE_UNKNOWN) {
+ if (op_mode == NL80211_IFTYPE_UNSPECIFIED) {
MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID);
pDevice->bBSSIDFilter = false;
pDevice->byRxMode &= ~RCR_BSSID;
@@ -749,7 +749,7 @@ bool CARDbSetBSSID(struct vnt_private *pDevice,
pr_debug("wmgr: rx_mode = %x\n", pDevice->byRxMode);
}
// Adopt BSS state in Adapter Device Object
- pDevice->eOPMode = eOPMode;
+ pDevice->op_mode = op_mode;
return true;
}

diff --git a/drivers/staging/vt6655/card.h b/drivers/staging/vt6655/card.h
index f7fd834..96f5b6c 100644
--- a/drivers/staging/vt6655/card.h
+++ b/drivers/staging/vt6655/card.h
@@ -31,6 +31,7 @@

#include "ttype.h"
#include <linux/types.h>
+#include <linux/nl80211.h>

//
// Loopback mode
@@ -70,13 +71,6 @@ typedef enum _CARD_STATUS_TYPE {
CARD_STATUS_PMKID
} CARD_STATUS_TYPE, *PCARD_STATUS_TYPE;

-typedef enum _CARD_OP_MODE {
- OP_MODE_INFRASTRUCTURE,
- OP_MODE_ADHOC,
- OP_MODE_AP,
- OP_MODE_UNKNOWN
-} CARD_OP_MODE, *PCARD_OP_MODE;
-
struct vnt_private;

void CARDvSetRSPINF(struct vnt_private *, CARD_PHY_TYPE ePHYType);
@@ -108,7 +102,7 @@ bool CARDbStopTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType);
bool CARDbStartTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType);
bool CARDbSetBeaconPeriod(struct vnt_private *, unsigned short wBeaconInterval);
bool CARDbSetBSSID(struct vnt_private *,
- unsigned char *pbyBSSID, CARD_OP_MODE eOPMode);
+ unsigned char *pbyBSSID, enum nl80211_iftype);

bool CARDbPowerDown(struct vnt_private *);

diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index 15303d9..7db0404 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -470,7 +470,7 @@ struct vnt_private {
unsigned short wFragmentationThreshold;
unsigned char byShortRetryLimit;
unsigned char byLongRetryLimit;
- CARD_OP_MODE eOPMode;
+ enum nl80211_iftype op_mode;
unsigned char byOpMode;
bool bBSSIDFilter;
unsigned short wMaxTransmitMSDULifetime;
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 0473702..f33795f 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -2341,7 +2341,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance)
}
}
if (pDevice->bChannelSwitch &&
- (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE)) {
+ (pDevice->op_mode == NL80211_IFTYPE_STATION)) {
pDevice->byChannelSwitchCount--;
if (pDevice->byChannelSwitchCount == 0) {
pDevice->bChannelSwitch = false;
@@ -2354,7 +2354,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance)

}
}
- if (pDevice->eOPMode != OP_MODE_ADHOC) {
+ if (pDevice->op_mode != NL80211_IFTYPE_ADHOC) {
if ((pDevice->bUpdateBBVGA) && pDevice->bLinkPass && (pDevice->uCurrRSSI != 0)) {
long ldBm;

@@ -2394,8 +2394,8 @@ static irqreturn_t device_intr(int irq, void *dev_instance)
if (pDevice->bEnablePSMode)
PSbIsNextTBTTWakeUp((void *)pDevice);

- if ((pDevice->eOPMode == OP_MODE_AP) ||
- (pDevice->eOPMode == OP_MODE_ADHOC)) {
+ if ((pDevice->op_mode == NL80211_IFTYPE_AP) ||
+ (pDevice->op_mode == NL80211_IFTYPE_ADHOC)) {
MACvOneShotTimer1MicroSec(pDevice->PortOffset,
(pMgmt->wIBSSBeaconPeriod - MAKE_BEACON_RESERVED) << 10);
}
@@ -2405,12 +2405,12 @@ static irqreturn_t device_intr(int irq, void *dev_instance)
}

if (pDevice->dwIsr & ISR_BNTX) {
- if (pDevice->eOPMode == OP_MODE_ADHOC) {
+ if (pDevice->op_mode == NL80211_IFTYPE_ADHOC) {
pDevice->bIsBeaconBufReadySet = false;
pDevice->cbBeaconBufReadySetCnt = 0;
}

- if (pDevice->eOPMode == OP_MODE_AP) {
+ if (pDevice->op_mode == NL80211_IFTYPE_AP) {
if (pMgmt->byDTIMCount > 0) {
pMgmt->byDTIMCount--;
pMgmt->sNodeDBTable[0].bRxPSPoll = false;
@@ -2453,7 +2453,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance)
max_count += device_tx_srv(pDevice, TYPE_AC0DMA);

if (pDevice->dwIsr & ISR_SOFTTIMER1) {
- if (pDevice->eOPMode == OP_MODE_AP) {
+ if (pDevice->op_mode == NL80211_IFTYPE_AP) {
if (pDevice->bShortSlotTime)
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1);
else
diff --git a/drivers/staging/vt6655/dpc.c b/drivers/staging/vt6655/dpc.c
index 60eb129..6fb6cdf 100644
--- a/drivers/staging/vt6655/dpc.c
+++ b/drivers/staging/vt6655/dpc.c
@@ -603,7 +603,7 @@ device_receive_frame(

// Now it only supports 802.11g Infrastructure Mode, and support rate must up to 54 Mbps
if (pDevice->bDiversityEnable && (FrameSize > 50) &&
- (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) &&
+ (pDevice->op_mode == NL80211_IFTYPE_STATION) &&
pDevice->bLinkPass) {
BBvAntennaDiversity(pDevice, s_byGetRateIdx(*pbyRxRate), 0);
}
diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c
index 6a6bdd3..14a62bd 100644
--- a/drivers/staging/vt6655/iwctl.c
+++ b/drivers/staging/vt6655/iwctl.c
@@ -76,7 +76,7 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev)
struct vnt_private *pDevice = netdev_priv(dev);
long ldBm;

- pDevice->wstats.status = pDevice->eOPMode;
+ pDevice->wstats.status = pDevice->op_mode;
#ifdef Calcu_LinkQual
if (pDevice->scStatistic.LinkQuality > 100)
pDevice->scStatistic.LinkQuality = 100;
diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c
index 93681b3..08241b9 100644
--- a/drivers/staging/vt6655/power.c
+++ b/drivers/staging/vt6655/power.c
@@ -78,7 +78,7 @@ PSvEnablePowerSaving(

// set period of power up before TBTT
VNSvOutPortW(pDevice->PortOffset + MAC_REG_PWBT, C_PWBT);
- if (pDevice->eOPMode != OP_MODE_ADHOC) {
+ if (pDevice->op_mode != NL80211_IFTYPE_ADHOC) {
// set AID
VNSvOutPortW(pDevice->PortOffset + MAC_REG_AIDATIM, wAID);
} else {
@@ -107,7 +107,8 @@ PSvEnablePowerSaving(
pDevice->bEnablePSMode = true;

/* We don't send null pkt in ad hoc mode since beacon will handle this. */
- if (pDevice->eOPMode != OP_MODE_ADHOC && pDevice->eOPMode == OP_MODE_INFRASTRUCTURE)
+ if (pDevice->op_mode != NL80211_IFTYPE_ADHOC &&
+ pDevice->op_mode == NL80211_IFTYPE_STATION)
PSbSendNullPacket(pDevice);

pDevice->bPWBitOn = true;
@@ -142,7 +143,7 @@ PSvDisablePowerSaving(

pDevice->bEnablePSMode = false;

- if (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE)
+ if (pDevice->op_mode == NL80211_IFTYPE_STATION)
PSbSendNullPacket(pDevice);

pDevice->bPWBitOn = false;
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 0c69193..7a183f5 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -851,13 +851,13 @@ s_vFillRTSHead(
IEEE80211_STYPE_RTS);


- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
+ if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) ||
+ (pDevice->op_mode == NL80211_IFTYPE_AP)) {
memcpy(&buf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
} else {
memcpy(&buf->data.ra, pDevice->abyBSSID, ETH_ALEN);
}
- if (pDevice->eOPMode == OP_MODE_AP)
+ if (pDevice->op_mode == NL80211_IFTYPE_AP)
memcpy(&buf->data.ta, pDevice->abyBSSID, ETH_ALEN);
else
memcpy(&buf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);
@@ -915,14 +915,14 @@ s_vFillRTSHead(
IEEE80211_STYPE_RTS);


- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
+ if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) ||
+ (pDevice->op_mode == NL80211_IFTYPE_AP)) {
memcpy(&buf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
} else {
memcpy(&buf->data.ra, pDevice->abyBSSID, ETH_ALEN);
}

- if (pDevice->eOPMode == OP_MODE_AP)
+ if (pDevice->op_mode == NL80211_IFTYPE_AP)
memcpy(&buf->data.ta, pDevice->abyBSSID, ETH_ALEN);
else
memcpy(&buf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);
@@ -948,14 +948,14 @@ s_vFillRTSHead(
IEEE80211_STYPE_RTS);


- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
+ if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) ||
+ (pDevice->op_mode == NL80211_IFTYPE_AP)) {
memcpy(&buf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
} else {
memcpy(&buf->data.ra, pDevice->abyBSSID, ETH_ALEN);
}

- if (pDevice->eOPMode == OP_MODE_AP)
+ if (pDevice->op_mode == NL80211_IFTYPE_AP)
memcpy(&buf->data.ta, pDevice->abyBSSID, ETH_ALEN);
else
memcpy(&buf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);
@@ -988,13 +988,13 @@ s_vFillRTSHead(
cpu_to_le16(IEEE80211_FTYPE_CTL |
IEEE80211_STYPE_RTS);

- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
+ if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) ||
+ (pDevice->op_mode == NL80211_IFTYPE_AP)) {
memcpy(&buf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
} else {
memcpy(&buf->data.ra, pDevice->abyBSSID, ETH_ALEN);
}
- if (pDevice->eOPMode == OP_MODE_AP)
+ if (pDevice->op_mode == NL80211_IFTYPE_AP)
memcpy(&buf->data.ta, pDevice->abyBSSID, ETH_ALEN);
else
memcpy(&buf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);
@@ -1016,14 +1016,14 @@ s_vFillRTSHead(
buf->data.frame_control =
cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS);

- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
+ if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) ||
+ (pDevice->op_mode == NL80211_IFTYPE_AP)) {
memcpy(&buf->data.ra, psEthHeader->abyDstAddr, ETH_ALEN);
} else {
memcpy(&buf->data.ra, pDevice->abyBSSID, ETH_ALEN);
}

- if (pDevice->eOPMode == OP_MODE_AP)
+ if (pDevice->op_mode == NL80211_IFTYPE_AP)
memcpy(&buf->data.ta, pDevice->abyBSSID, ETH_ALEN);
else
memcpy(&buf->data.ta, psEthHeader->abySrcAddr, ETH_ALEN);
@@ -1335,8 +1335,8 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,

pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL;

- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
+ if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) ||
+ (pDevice->op_mode == NL80211_IFTYPE_AP)) {
if (is_multicast_ether_addr(&(psEthHeader->abyDstAddr[0])))
bNeedACK = false;
else
@@ -1976,8 +1976,8 @@ vGenerateFIFOHeader(struct vnt_private *pDevice, unsigned char byPktType,
memset(pTxBufHead, 0, wTxBufSize);
//Set FIFOCTL_NEEDACK

- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
+ if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) ||
+ (pDevice->op_mode == NL80211_IFTYPE_AP)) {
if (is_multicast_ether_addr(&(psEthHeader->abyDstAddr[0]))) {
bNeedACK = false;
pTxBufHead->wFIFOCtl = pTxBufHead->wFIFOCtl & (~FIFOCTL_NEEDACK);
@@ -2104,13 +2104,13 @@ vGenerateMACHeader(
else
pMACHeader->wFrameCtl = TYPE_802_11_DATA;

- if (pDevice->eOPMode == OP_MODE_AP) {
+ if (pDevice->op_mode == NL80211_IFTYPE_AP) {
memcpy(&(pMACHeader->abyAddr1[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
memcpy(&(pMACHeader->abyAddr2[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
memcpy(&(pMACHeader->abyAddr3[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
pMACHeader->wFrameCtl |= FC_FROMDS;
} else {
- if (pDevice->eOPMode == OP_MODE_ADHOC) {
+ if (pDevice->op_mode == NL80211_IFTYPE_ADHOC) {
memcpy(&(pMACHeader->abyAddr1[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
memcpy(&(pMACHeader->abyAddr2[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
memcpy(&(pMACHeader->abyAddr3[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
@@ -2349,7 +2349,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, PSTxMgmtPacket pPacket)
// S/W or H/W Encryption
//---------------------------
do {
- if ((pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) &&
+ if ((pDevice->op_mode == NL80211_IFTYPE_STATION) &&
(pDevice->bLinkPass == true)) {
pbyBSSID = pDevice->abyBSSID;
// get pairwise key
@@ -2369,7 +2369,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, PSTxMgmtPacket pPacket)
if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == false) {
pTransmitKey = NULL;
pr_debug("KEY is NULL. OP Mode[%d]\n",
- pDevice->eOPMode);
+ pDevice->op_mode);
} else {
pr_debug("Get GTK\n");
}
@@ -2531,8 +2531,8 @@ cbGetFragCount(
unsigned int uMACfragNum = 1;
bool bNeedACK;

- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
+ if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) ||
+ (pDevice->op_mode == NL80211_IFTYPE_AP)) {
if (is_multicast_ether_addr(&(psEthHeader->abyDstAddr[0])))
bNeedACK = false;
else
diff --git a/drivers/staging/vt6655/wcmd.c b/drivers/staging/vt6655/wcmd.c
index 7565073..985e1b9 100644
--- a/drivers/staging/vt6655/wcmd.c
+++ b/drivers/staging/vt6655/wcmd.c
@@ -328,7 +328,7 @@ vCommandTimer(

if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
s_bCommandComplete(pDevice);
- CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_AP);
+ CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, NL80211_IFTYPE_AP);
spin_unlock_irq(&pDevice->lock);
return;
}
@@ -356,9 +356,9 @@ vCommandTimer(
pr_debug("Scanning, set back to channel: [%d]\n",
pMgmt->uCurrChannel);
if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)
- CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC);
+ CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, NL80211_IFTYPE_ADHOC);
else
- CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_INFRASTRUCTURE);
+ CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, NL80211_IFTYPE_STATION);

vAdHocBeaconRestart(pDevice);
s_bCommandComplete(pDevice);
@@ -393,7 +393,7 @@ vCommandTimer(
pr_debug("SET SCAN Channel Fail: %d\n",
pMgmt->uScanChannel);

- CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_UNKNOWN);
+ CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, NL80211_IFTYPE_UNSPECIFIED);
pMgmt->uScanChannel++;
//2008-8-4 <modify> by chester
if (!is_channel_valid(pMgmt->uScanChannel) &&
@@ -427,9 +427,9 @@ vCommandTimer(
pr_debug("Scanning, set back to channel: [%d]\n",
pMgmt->uCurrChannel);
if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)
- CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC);
+ CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, NL80211_IFTYPE_ADHOC);
else
- CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_INFRASTRUCTURE);
+ CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, NL80211_IFTYPE_STATION);

pMgmt->eScanState = WMAC_NO_SCANNING;
vAdHocBeaconRestart(pDevice);
diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c
index ba273c7..c73c39d 100644
--- a/drivers/staging/vt6655/wmgr.c
+++ b/drivers/staging/vt6655/wmgr.c
@@ -2356,9 +2356,9 @@ vMgrCreateOwnIBSS(
pMgmt->byERPContext = 0;

if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
- CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_AP);
+ CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, NL80211_IFTYPE_AP);
} else {
- CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC);
+ CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, NL80211_IFTYPE_ADHOC);
}

CARDbSetPhyParameter(pMgmt->pAdapter,
@@ -2727,13 +2727,13 @@ s_vMgrSynchBSS(
}

if (WLAN_GET_CAP_INFO_ESS(pCurr->wCapInfo)) {
- CARDbSetBSSID(pMgmt->pAdapter, pCurr->abyBSSID, OP_MODE_INFRASTRUCTURE);
+ CARDbSetBSSID(pMgmt->pAdapter, pCurr->abyBSSID, NL80211_IFTYPE_STATION);
// Add current BSS to Candidate list
// This should only works for WPA2 BSS, and WPA2 BSS check must be done before.
if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)
CARDbAdd_PMKID_Candidate(pMgmt->pAdapter, pMgmt->abyCurrBSSID, pCurr->sRSNCapObj.bRSNCapExist, pCurr->sRSNCapObj.wRSNCap);
} else {
- CARDbSetBSSID(pMgmt->pAdapter, pCurr->abyBSSID, OP_MODE_ADHOC);
+ CARDbSetBSSID(pMgmt->pAdapter, pCurr->abyBSSID, NL80211_IFTYPE_ADHOC);
}

if (!CARDbSetPhyParameter(pMgmt->pAdapter,
--
1.9.1


2014-08-30 21:26:59

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 21/23] stgaing: vt6655: remove unused variable wCTSDuration

wCTSDuration is always set to 0.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/device.h | 1 -
drivers/staging/vt6655/device_main.c | 1 -
drivers/staging/vt6655/rxtx.c | 7 +------
3 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index 8ac7901..15303d9 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -476,7 +476,6 @@ struct vnt_private {
unsigned short wMaxTransmitMSDULifetime;
unsigned char abyBSSID[ETH_ALEN];
unsigned char abyDesireBSSID[ETH_ALEN];
- unsigned short wCTSDuration; // update while speed change
unsigned short wACKDuration; // update while speed change
unsigned short wRTSTransmitLen; // update while speed change
unsigned char byRTSServiceField; // update while speed change
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 34a70b0..0473702 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -387,7 +387,6 @@ device_set_options(struct vnt_private *pDevice)
pDevice->byAutoFBCtrl = AUTO_FB_0;
pDevice->bUpdateBBVGA = true;
pDevice->byFOETuning = 0;
- pDevice->wCTSDuration = 0;
pDevice->byPreambleType = 0;

pr_debug(" uChannel= %d\n", (int)pDevice->uChannel);
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 6b22f09..3c8c499 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -1051,22 +1051,17 @@ s_vFillCTSHead(

buf->duration_ba = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength,
byPktType, wCurrentRate, bNeedAck, byFBOption);
- buf->duration_ba += pDevice->wCTSDuration;
-
buf->duration_ba = cpu_to_le16(buf->duration_ba);
/* Get CTSDuration_ba_f0 */
buf->cts_duration_ba_f0 = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F0, cbFrameLength,
byPktType, wCurrentRate,
bNeedAck, byFBOption);

- buf->cts_duration_ba_f0 += pDevice->wCTSDuration;
-
buf->cts_duration_ba_f0 = cpu_to_le16(buf->cts_duration_ba_f0);
//Get CTSDuration_ba_f1
buf->cts_duration_ba_f1 = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F1, cbFrameLength,
byPktType, wCurrentRate,
bNeedAck, byFBOption);
- buf->cts_duration_ba_f1 += pDevice->wCTSDuration;

buf->cts_duration_ba_f1 = cpu_to_le16(buf->cts_duration_ba_f1);
/* Get CTS Frame body */
@@ -1091,7 +1086,7 @@ s_vFillCTSHead(
cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength,
byPktType, wCurrentRate, bNeedAck,
byFBOption));
- buf->duration_ba += pDevice->wCTSDuration;
+
buf->duration_ba = cpu_to_le16(buf->duration_ba);

/* Get CTS Frame body */
--
1.9.1


2014-08-30 21:26:40

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 10/23] staging: vt6655: replace typedef struct tagSTxDataHead_ab with struct vnt_tx_datahead_ab

Replacing members
ab, wDuration and wTimeStampOff

with
ab, duration and time_stamp_off

All unsigned short should be __le16

Structure is moved to rxtx.h

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/desc.h | 8 ------
drivers/staging/vt6655/rxtx.c | 61 +++++++++++++++++++++++--------------------
drivers/staging/vt6655/rxtx.h | 6 +++++
3 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 0945c07..ed5052a 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -459,14 +459,6 @@ typedef const STxBufHead *PCSTxBufHead;
//
// Tx data header
//
-typedef struct tagSTxDataHead_ab {
- struct vnt_phy_field ab;
- unsigned short wDuration;
- unsigned short wTimeStampOff;
-} __attribute__ ((__packed__))
-STxDataHead_ab, *PSTxDataHead_ab;
-typedef const STxDataHead_ab *PCSTxDataHead_ab;
-
typedef struct tagSTxDataHead_a_FB {
struct vnt_phy_field a;
unsigned short wDuration;
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index d8e3347..627cacb 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -760,32 +760,32 @@ s_uFillDataHead(
pBuf->wTimeStampOff = vnt_time_stamp_off(pDevice, wCurrentRate);
return pBuf->wDuration;
} else {
- PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead;
+ struct vnt_tx_datahead_ab *buf = pTxDataHead;
/* Get SignalField, ServiceField & Length */
vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate,
- byPktType, &pBuf->ab);
- //Get Duration and TimeStampOff
+ byPktType, &buf->ab);

- pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx,
- cbLastFragmentSize, uMACfragNum,
- byFBOption));
+ /* Get Duration and TimeStampOff */
+ buf->duration = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, uFragIdx,
+ cbLastFragmentSize, uMACfragNum,
+ byFBOption));

- pBuf->wTimeStampOff = vnt_time_stamp_off(pDevice, wCurrentRate);
- return pBuf->wDuration;
+ buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate);
+ return buf->duration;
}
} else {
- PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead;
+ struct vnt_tx_datahead_ab *buf = pTxDataHead;
/* 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,
- cbLastFragmentSize, uMACfragNum,
- byFBOption));
- pBuf->wTimeStampOff = vnt_time_stamp_off(pDevice, wCurrentRate);
- return pBuf->wDuration;
+ byPktType, &buf->ab);
+ /* Get Duration and TimeStampOff */
+ buf->duration = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, uFragIdx,
+ cbLastFragmentSize, uMACfragNum,
+ byFBOption));
+ buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate);
+ return buf->duration;
}
return 0;
}
@@ -1356,15 +1356,18 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
pvRTS = (PSRTS_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(SRTS_ab));
- cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(SRTS_ab) + sizeof(STxDataHead_ab);
+ pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(SRTS_ab));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) +
+ cbMICHDR + sizeof(SRTS_ab) + sizeof(struct vnt_tx_datahead_ab);
} else { //RTS_needless, need MICHDR
pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
pvRTS = NULL;
pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
- cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(STxDataHead_ab);
+ pvTxDataHd = (void *)(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
@@ -2201,8 +2204,10 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, PSTxMgmtPacket pPacket)
pMICHDR = NULL;
pvRTS = NULL;
pCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
- cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + sizeof(STxDataHead_ab);
+ pvTxDataHd = (void *)(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));
@@ -2297,7 +2302,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, PSTxMgmtPacket pPacket)
((struct vnt_tx_datahead_g *)pvTxDataHd)->duration_a = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
((struct vnt_tx_datahead_g *)pvTxDataHd)->duration_b = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
} else {
- ((PSTxDataHead_ab)pvTxDataHd)->wDuration = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
+ ((struct vnt_tx_datahead_ab *)pvTxDataHd)->duration = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
}
}

@@ -2692,10 +2697,10 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb,
wTxBufSize + sizeof(struct vnt_rrv_time_ab));
pvRTS = NULL;
pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr +
+ pvTxDataHd = (void *)(pbyTxBufferAddr +
wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_ab) +
- cbMICHDR + sizeof(STxDataHead_ab);
+ cbMICHDR + sizeof(struct vnt_tx_datahead_ab);

}

@@ -2823,7 +2828,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb,
((struct vnt_tx_datahead_g *)pvTxDataHd)->duration_a = cpu_to_le16(p80211Header->sA2.wDurationID);
((struct vnt_tx_datahead_g *)pvTxDataHd)->duration_b = cpu_to_le16(p80211Header->sA2.wDurationID);
} else {
- ((PSTxDataHead_ab)pvTxDataHd)->wDuration = cpu_to_le16(p80211Header->sA2.wDurationID);
+ ((struct vnt_tx_datahead_ab *)pvTxDataHd)->duration = cpu_to_le16(p80211Header->sA2.wDurationID);
}
}

diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h
index 212c2ef..4899f6e 100644
--- a/drivers/staging/vt6655/rxtx.h
+++ b/drivers/staging/vt6655/rxtx.h
@@ -99,6 +99,12 @@ struct vnt_tx_datahead_g_fb {
__le16 time_stamp_off_a;
} __packed;

+struct vnt_tx_datahead_ab {
+ struct vnt_phy_field ab;
+ __le16 duration;
+ __le16 time_stamp_off;
+} __packed;
+
struct vnt_tx_short_buf_head {
__le16 fifo_ctl;
u16 time_stamp;
--
1.9.1


2014-08-30 21:26:42

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 11/23] staging: vt6655: replace -typedef struct tagSTxDataHead_a_FB with struct vnt_tx_datahead_a_fb

Replace members
a, wDuration, wTimeStampOff, wDuration_f0, and wDuration_f1;
with
a, duration, time_stamp_off, duration_f0, duration_f1

All unsigned short members should be __le16

Creating the new structure in rxtx.h.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/desc.h | 13 -------------
drivers/staging/vt6655/rxtx.c | 35 ++++++++++++++++++-----------------
drivers/staging/vt6655/rxtx.h | 8 ++++++++
3 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index ed5052a..0da860e 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -456,19 +456,6 @@ typedef struct tagSTxBufHead {
STxBufHead, *PSTxBufHead;
typedef const STxBufHead *PCSTxBufHead;

-//
-// Tx data header
-//
-typedef struct tagSTxDataHead_a_FB {
- struct vnt_phy_field a;
- unsigned short wDuration;
- unsigned short wTimeStampOff;
- unsigned short wDuration_f0;
- unsigned short wDuration_f1;
-} __attribute__ ((__packed__))
-STxDataHead_a_FB, *PSTxDataHead_a_FB;
-typedef const STxDataHead_a_FB *PCSTxDataHead_a_FB;
-
typedef struct tagSBEACONCtl {
u32 BufReady:1;
u32 TSF:15;
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 627cacb..bd0e339 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -743,22 +743,21 @@ s_uFillDataHead(
} //if (byFBOption == AUTO_FB_NONE)
} else if (byPktType == PK_TYPE_11A) {
if ((byFBOption != AUTO_FB_NONE)) {
- // Auto Fallback
- PSTxDataHead_a_FB pBuf = (PSTxDataHead_a_FB)pTxDataHead;
+ /* Auto Fallback */
+ struct vnt_tx_datahead_a_fb *buf = pTxDataHead;
/* Get SignalField, ServiceField & Length */
vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate,
- byPktType, &pBuf->a);
-
- //Get Duration and TimeStampOff
+ byPktType, &buf->a);

- pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //0: 5GHz
- pBuf->wDuration_f0 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //0: 5GHz
- pBuf->wDuration_f1 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //0: 5GHz
- pBuf->wTimeStampOff = vnt_time_stamp_off(pDevice, wCurrentRate);
- return pBuf->wDuration;
+ /* Get Duration and TimeStampOff */
+ buf->duration = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
+ buf->duration_f0 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
+ buf->duration_f1 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
+ buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate);
+ return buf->duration;
} else {
struct vnt_tx_datahead_ab *buf = pTxDataHead;
/* Get SignalField, ServiceField & Length */
@@ -1376,15 +1375,17 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
pvRTS = (PSRTS_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(SRTS_a_FB));
- cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(SRTS_a_FB) + sizeof(STxDataHead_a_FB);
+ pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(SRTS_a_FB));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) +
+ cbMICHDR + sizeof(SRTS_a_FB) + sizeof(struct vnt_tx_datahead_a_fb);
} else { //RTS_needless
pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
pvRTS = NULL;
pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
- cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR + sizeof(STxDataHead_a_FB);
+ pvTxDataHd = (void *)(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
}
diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h
index 4899f6e..21bbc7e 100644
--- a/drivers/staging/vt6655/rxtx.h
+++ b/drivers/staging/vt6655/rxtx.h
@@ -105,6 +105,14 @@ struct vnt_tx_datahead_ab {
__le16 time_stamp_off;
} __packed;

+struct vnt_tx_datahead_a_fb {
+ struct vnt_phy_field a;
+ __le16 duration;
+ __le16 time_stamp_off;
+ __le16 duration_f0;
+ __le16 duration_f1;
+} __packed;
+
struct vnt_tx_short_buf_head {
__le16 fifo_ctl;
u16 time_stamp;
--
1.9.1