Skip to contentSkip to conversation

staging: vt6655: rxtx replace typedef struct tagSRrvTime_gRTS with struct vnt_rrv_time_rts

PATCH New Malcolm Priestley 1 participant 23 messages Aug 30, 2014 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/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

---
 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(-)
drivers/staging/vt6655/desc.h +0 -11
index b5730df..49a2e04 100644
@@ -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;
drivers/staging/vt6655/rxtx.c +16 -16
index 7493db1..609aec8 100644
@@ -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));
drivers/staging/vt6655/rxtx.h +10 -0
index 789fae7..f5f6478 100644
@@ -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;
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/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

---
 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(-)
drivers/staging/vt6655/desc.h +0 -9
index 49a2e04..237a99c 100644
@@ -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;
drivers/staging/vt6655/rxtx.c +30 -24

90 lines not on this page · raw message

drivers/staging/vt6655/rxtx.h +7 -0
index f5f6478..4dca615 100644
@@ -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;
Signature · 1 line
1.9.1
#2 lore raw

PATCH 3/23 staging: vt6655: rxtx replace typedef struct tagSRrvTime_ab with struct vnt_rrv_time_ab

In reply to Malcolm Priestley

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

---
 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(-)
drivers/staging/vt6655/desc.h +0 -7
index 237a99c..84de4ef 100644
@@ -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;
drivers/staging/vt6655/rxtx.c +38 -35

136 lines not on this page · raw message

drivers/staging/vt6655/rxtx.h +5 -0
index 4dca615..a14b5f1 100644
@@ -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;
Signature · 1 line
1.9.1
#3 lore raw

PATCH 4/23 staging: vt6655: create vnt_rxtx_rsvtime_le16 to return s_uGetTxRsvTime endian corrected.

In reply to Malcolm Priestley

Replace s_uGetTxRsvTime where endian correction is needed.

---
 drivers/staging/vt6655/rxtx.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/staging/vt6655/rxtx.c +15 -8
index a0b8384..627bfbd 100644
@@ -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);
 			}
 		}
 	}
Signature · 1 line
1.9.1
#4 lore raw

PATCH 5/23 staging: vt6655: rxtx change s_uGetRTSCTSRsvTime to always return __le16

In reply to Malcolm Priestley

s_uGetRTSCTSRsvTime always needs to return little endian __le16

---
 drivers/staging/vt6655/rxtx.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/staging/vt6655/rxtx.c +9 -9
index 627bfbd..ee20ae2 100644
@@ -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
Signature · 1 line
1.9.1
#5 lore raw

PATCH 6/23 staging: vt6655: s_vGenerateTxParameter removed nested pvRrvTime NULL check

In reply to Malcolm Priestley

Just do single NULL check on pvRrvTime and return.

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

---
 drivers/staging/vt6655/rxtx.c | 69 ++++++++++++++++++-------------------------
 1 file changed, 28 insertions(+), 41 deletions(-)
drivers/staging/vt6655/rxtx.c +28 -41
index ee20ae2..afdf3ab 100644
@@ -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);
 		}
 	}
 }
Signature · 1 line
1.9.1
#6 lore raw

PATCH 7/23 staging: vt6655: rxtx.c create function to return __le16 wTimeStampOff

In reply to Malcolm Priestley

wTimeStampOff always needs to be endian corrected.

Create vnt_time_stamp_off to return this value.

---
 drivers/staging/vt6655/rxtx.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/staging/vt6655/rxtx.c +14 -8
index afdf3ab..9617701 100644
@@ -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
Signature · 1 line
1.9.1
#7 lore raw

PATCH 8/23 staging: vt6655: replace typedef struct tagSTxDataHead_g with struct vnt_tx_datahead_g

In reply to Malcolm Priestley

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

---
 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(-)
drivers/staging/vt6655/desc.h +0 -11
index 84de4ef..27b6fd7 100644
@@ -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;
drivers/staging/vt6655/rxtx.c +32 -30

112 lines not on this page · raw message

drivers/staging/vt6655/rxtx.h +10 -0
index a14b5f1..0fe9998 100644
@@ -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;
Signature · 1 line
1.9.1
#8 lore raw

PATCH 9/23 staging: vt6655: replace typedef struct tagSTxDataHead_g_FB with struct vnt_tx_datahead_g_fb

In reply to Malcolm Priestley

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

---
 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(-)
drivers/staging/vt6655/desc.h +0 -13
index 27b6fd7..0945c07 100644
@@ -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;
drivers/staging/vt6655/rxtx.c +24 -22

68 lines not on this page · raw message

drivers/staging/vt6655/rxtx.h +11 -0
index 0fe9998..212c2ef 100644
@@ -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;
Signature · 1 line
1.9.1
#9 lore raw

PATCH 10/23 staging: vt6655: replace typedef struct tagSTxDataHead_ab with struct vnt_tx_datahead_ab

In reply to Malcolm Priestley

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

---
 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(-)
drivers/staging/vt6655/desc.h +0 -8
index 0945c07..ed5052a 100644
@@ -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;
drivers/staging/vt6655/rxtx.c +33 -28

112 lines not on this page · raw message

drivers/staging/vt6655/rxtx.h +6 -0
index 212c2ef..4899f6e 100644
@@ -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;
Signature · 1 line
1.9.1
#10 lore raw

PATCH 11/23 staging: vt6655: replace -typedef struct tagSTxDataHead_a_FB with struct vnt_tx_datahead_a_fb

In reply to Malcolm Priestley

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.

---
 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(-)
drivers/staging/vt6655/desc.h +0 -13
index ed5052a..0da860e 100644
@@ -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;
drivers/staging/vt6655/rxtx.c +18 -17
index 627cacb..bd0e339 100644
@@ -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
 	}
drivers/staging/vt6655/rxtx.h +8 -0
index 4899f6e..21bbc7e 100644
@@ -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;
Signature · 1 line
1.9.1
#11 lore raw

PATCH 12/23 staging: vt6655: Fix *Duration s_uFillDataHead to return to __le16

In reply to Malcolm Priestley

All callers should be __le16.

Fix vGenerateMACHeader duration to __le16 and reverse the endian conversion.

---
 drivers/staging/vt6655/rxtx.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/staging/vt6655/rxtx.c +9 -9
index bd0e339..0171f64 100644
@@ -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;
Signature · 1 line
1.9.1
#12 lore raw

PATCH 13/23 staging: vt6655: Replace typedef struct tagSRTSData with ieee80211_rts data

In reply to Malcolm Priestley

Replacing SRTSData Data with struct ieee80211_rts data

---
 drivers/staging/vt6655/desc.h | 21 +++--------
 drivers/staging/vt6655/rxtx.c | 84 +++++++++++++++++++++++++------------------
 2 files changed, 54 insertions(+), 51 deletions(-)
drivers/staging/vt6655/desc.h +5 -16
index 0da860e..3ce5fe8 100644
@@ -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;
drivers/staging/vt6655/rxtx.c +49 -35

151 lines not on this page · raw message

Signature · 1 line
1.9.1
#13 lore raw

PATCH 14/23 staging: vt6655: Replace typedef struct tagSCTSData with ieee80211_cts data

In reply to Malcolm Priestley

ieee80211_cts data needs extra padding with reserved2 set to 0

use IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS to set frame_control

---
 drivers/staging/vt6655/desc.h | 14 ++++----------
 drivers/staging/vt6655/rxtx.c | 26 +++++++++++++++++---------
 2 files changed, 21 insertions(+), 19 deletions(-)
drivers/staging/vt6655/desc.h +4 -10
index 3ce5fe8..00c3922 100644
@@ -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;
drivers/staging/vt6655/rxtx.c +17 -9
index 208643e..d94d496 100644
@@ -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);
 		}
 	}
 }
Signature · 1 line
1.9.1
#14 lore raw

PATCH 15/23 staging: vt6655: replace typedef struct tagSRTS_g with struct vnt_rts_g

In reply to Malcolm Priestley

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

---
 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(-)
drivers/staging/vt6655/desc.h +0 -12
index 00c3922..5fbef74 100644
@@ -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;
drivers/staging/vt6655/rxtx.c +28 -17

76 lines not on this page · raw message

drivers/staging/vt6655/rxtx.h +11 -0
index 21bbc7e..377cd42 100644
@@ -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;
Signature · 1 line
1.9.1
#15 lore raw

PATCH 16/23 staging: vt6655: replace typedef struct tagSRTS_g_FB with struct vnt_rts_g_fb

In reply to Malcolm Priestley

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

---
 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(-)
drivers/staging/vt6655/desc.h +0 -16
index 5fbef74..e1c686e 100644
@@ -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;
drivers/staging/vt6655/rxtx.c +42 -20

94 lines not on this page · raw message

drivers/staging/vt6655/rxtx.h +14 -0
index 377cd42..b9153e0 100644
@@ -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;
Signature · 1 line
1.9.1
#16 lore raw

PATCH 17/23 staging: vt6655: replace typedef struct tagSRTS_ab with struct vnt_rts_ab

In reply to Malcolm Priestley

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

---
 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(-)
drivers/staging/vt6655/desc.h +0 -9
index e1c686e..de459d8 100644
@@ -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;
drivers/staging/vt6655/rxtx.c +29 -23

101 lines not on this page · raw message

drivers/staging/vt6655/rxtx.h +7 -0
index b9153e0..807753c 100644
@@ -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;
Signature · 1 line
1.9.1
#17 lore raw

PATCH 18/23 staging: vt6655: replace typedef struct tagSRTS_a_FB with struct vnt_rts_a_fb

In reply to Malcolm Priestley

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

---
 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(-)
drivers/staging/vt6655/desc.h +0 -11
index de459d8..f0a31a8 100644
@@ -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
 //
drivers/staging/vt6655/rxtx.c +25 -16

68 lines not on this page · raw message

drivers/staging/vt6655/rxtx.h +9 -0
index 807753c..bac2214 100644
@@ -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;
Signature · 1 line
1.9.1
#18 lore raw

PATCH 19/23 staging: vt6655: replace typedef struct tagSCTS with struct vnt_cts

In reply to Malcolm Priestley

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

---
 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(-)
drivers/staging/vt6655/desc.h +0 -10
index f0a31a8..4d9027e 100644
@@ -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;
drivers/staging/vt6655/rxtx.c +25 -21

92 lines not on this page · raw message

drivers/staging/vt6655/rxtx.h +9 -0
index bac2214..2c09c11 100644
@@ -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;
Signature · 1 line
1.9.1
#19 lore raw

PATCH 20/23 staging: vt6655: replace typedef struct tagSCTS_FB with struct vnt_cts_fb

In reply to Malcolm Priestley

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

---
 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(-)
drivers/staging/vt6655/desc.h +0 -15
index 4d9027e..5a2bbd2 100644
@@ -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 {
drivers/staging/vt6655/rxtx.c +30 -20

73 lines not on this page · raw message

drivers/staging/vt6655/rxtx.h +10 -0
index 2c09c11..8ee6288 100644
@@ -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;
Signature · 1 line
1.9.1
#20 lore raw

PATCH 21/23 stgaing: vt6655: remove unused variable wCTSDuration

In reply to Malcolm Priestley

wCTSDuration is always set to 0.

---
 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(-)
drivers/staging/vt6655/device.h +0 -1
index 8ac7901..15303d9 100644
@@ -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
drivers/staging/vt6655/device_main.c +0 -1
index 34a70b0..0473702 100644
@@ -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);
drivers/staging/vt6655/rxtx.c +1 -6
index 6b22f09..3c8c499 100644
@@ -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 */
Signature · 1 line
1.9.1
#21 lore raw

PATCH 22/23 staging: vt6655: s_uGetRTSCTSDuration always return __le16

In reply to Malcolm Priestley

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

---
 drivers/staging/vt6655/rxtx.c | 149 ++++++++++++++++++++++++------------------
 1 file changed, 84 insertions(+), 65 deletions(-)
drivers/staging/vt6655/rxtx.c +84 -65
index 3c8c499..0c69193 100644
@@ -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;
Signature · 1 line
1.9.1
#22 lore raw

PATCH 23/23 staging: vt6655: Replace typedef enum _CARD_OP_MODE eOPMode with enum nl80211_iftype op_mode.

In reply to Malcolm Priestley

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

---
 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(-)
drivers/staging/vt6655/card.c +6 -6
index c4ed8d5..5a69502 100644
@@ -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;
 }
 
drivers/staging/vt6655/card.h +2 -8
index f7fd834..96f5b6c 100644
@@ -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 *);
 
drivers/staging/vt6655/device.h +1 -1
index 15303d9..7db0404 100644
@@ -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;
drivers/staging/vt6655/device_main.c +7 -7
index 0473702..f33795f 100644
@@ -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
drivers/staging/vt6655/dpc.c +1 -1
index 60eb129..6fb6cdf 100644
@@ -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);
 	}
drivers/staging/vt6655/iwctl.c +1 -1
index 6a6bdd3..14a62bd 100644
@@ -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;
drivers/staging/vt6655/power.c +4 -3
index 93681b3..08241b9 100644
@@ -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;
drivers/staging/vt6655/rxtx.c +25 -25

144 lines not on this page · raw message

drivers/staging/vt6655/wcmd.c +6 -6
index 7565073..985e1b9 100644
@@ -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);
drivers/staging/vt6655/wmgr.c +4 -4
index ba273c7..c73c39d 100644
@@ -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,
Signature · 1 line
1.9.1