2014-03-22 09:02:18

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 01/10] staging: vt6656: rxtx.c: s_vFillTxKey Replace dwRevIVCounter

Fix base type to __le32 and remove camel case.

Camel case change
dwRevIVCounter -> rev_iv_counter

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 3840323..9f80a7a 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -184,28 +184,28 @@ static void s_vFillTxKey(struct vnt_private *pDevice,
u32 *pdwIV = (u32 *)pbyIVHead;
u32 *pdwExtIV = (u32 *)((u8 *)pbyIVHead + 4);
struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyHdrBuf;
- u32 dwRevIVCounter;
+ __le32 rev_iv_counter;

/* Fill TXKEY */
if (pTransmitKey == NULL)
return;

- dwRevIVCounter = cpu_to_le32(pDevice->dwIVCounter);
+ rev_iv_counter = cpu_to_le32(pDevice->dwIVCounter);
*pdwIV = pDevice->dwIVCounter;
pDevice->byKeyIndex = pTransmitKey->dwKeyIndex & 0xf;

switch (pTransmitKey->byCipherSuite) {
case KEY_CTL_WEP:
if (pTransmitKey->uKeyLength == WLAN_WEP232_KEYLEN) {
- memcpy(pDevice->abyPRNG, (u8 *)&dwRevIVCounter, 3);
+ memcpy(pDevice->abyPRNG, (u8 *)&rev_iv_counter, 3);
memcpy(pDevice->abyPRNG + 3, pTransmitKey->abyKey,
pTransmitKey->uKeyLength);
} else {
- memcpy(pbyBuf, (u8 *)&dwRevIVCounter, 3);
+ memcpy(pbyBuf, (u8 *)&rev_iv_counter, 3);
memcpy(pbyBuf + 3, pTransmitKey->abyKey,
pTransmitKey->uKeyLength);
if (pTransmitKey->uKeyLength == WLAN_WEP40_KEYLEN) {
- memcpy(pbyBuf+8, (u8 *)&dwRevIVCounter, 3);
+ memcpy(pbyBuf+8, (u8 *)&rev_iv_counter, 3);
memcpy(pbyBuf+11, pTransmitKey->abyKey,
pTransmitKey->uKeyLength);
}
--
1.9.0



2014-03-22 09:02:36

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 09/10] staging: vt6656: vnt_fill_ieee80211_rts replace TYPE_CTL_RTS macro

Replace with IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS from linux/ieee80211.h
to get value of TYPE_CTL_RTS and endian correct to frame_control.

Remove old macros in tether.h

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/rxtx.c | 3 ++-
drivers/staging/vt6656/tether.h | 2 --
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 2b67b1b..ac60999 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -551,7 +551,8 @@ static int vnt_fill_ieee80211_rts(struct vnt_private *priv,
__le16 duration)
{
rts->duration = duration;
- rts->frame_control = TYPE_CTL_RTS;
+ rts->frame_control =
+ cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS);

if (priv->op_mode == NL80211_IFTYPE_ADHOC ||
priv->op_mode == NL80211_IFTYPE_AP)
diff --git a/drivers/staging/vt6656/tether.h b/drivers/staging/vt6656/tether.h
index aec6b56..f42edda 100644
--- a/drivers/staging/vt6656/tether.h
+++ b/drivers/staging/vt6656/tether.h
@@ -60,7 +60,6 @@
#define TYPE_DATE_NULL 0x4800

#define TYPE_CTL_PSPOLL 0xa400
-#define TYPE_CTL_RTS 0xb400
#define TYPE_CTL_CTS 0xc400
#define TYPE_CTL_ACK 0xd400

@@ -91,7 +90,6 @@
#define TYPE_DATE_NULL 0x0048

#define TYPE_CTL_PSPOLL 0x00a4
-#define TYPE_CTL_RTS 0x00b4
#define TYPE_CTL_CTS 0x00c4
#define TYPE_CTL_ACK 0x00d4

--
1.9.0


2014-03-22 09:02:31

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 06/10] staging: vt6656: rxtx struct vnt_tx_buffer Replace wTxByteCount

Replace with tx_byte_count with base type __le16.

In nsDMA_tx_packet and bRelayPacketSend provide endian correction.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/rxtx.c | 8 ++++----
drivers/staging/vt6656/rxtx.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 1624efb..c17c3da 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -1605,7 +1605,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
}
}

- pTX_Buffer->wTxByteCount = cpu_to_le16((u16)(cbReqCount));
+ pTX_Buffer->tx_byte_count = cpu_to_le16((u16)(cbReqCount));
pTX_Buffer->byPKTNO = (u8) (((wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F));
pTX_Buffer->byType = 0x00;

@@ -2045,7 +2045,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
}
}

- pTX_Buffer->wTxByteCount = cpu_to_le16((u16)(cbReqCount));
+ pTX_Buffer->tx_byte_count = cpu_to_le16((u16)(cbReqCount));
pTX_Buffer->byPKTNO = (u8) (((wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F));
pTX_Buffer->byType = 0x00;

@@ -2437,7 +2437,7 @@ int nsDMA_tx_packet(struct vnt_private *pDevice,
}

pTX_Buffer->byPKTNO = (u8) (((pDevice->wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F));
- pTX_Buffer->wTxByteCount = (u16)BytesToWrite;
+ pTX_Buffer->tx_byte_count = cpu_to_le16((u16)BytesToWrite);

pContext->pPacket = skb;
pContext->type = CONTEXT_DATA_PACKET;
@@ -2591,7 +2591,7 @@ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen,
}

pTX_Buffer->byPKTNO = (u8) (((pDevice->wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F));
- pTX_Buffer->wTxByteCount = (u16)BytesToWrite;
+ pTX_Buffer->tx_byte_count = cpu_to_le16((u16)BytesToWrite);

pContext->pPacket = NULL;
pContext->type = CONTEXT_DATA_PACKET;
diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h
index d7e4273..0233761 100644
--- a/drivers/staging/vt6656/rxtx.h
+++ b/drivers/staging/vt6656/rxtx.h
@@ -225,7 +225,7 @@ struct vnt_tx_fifo_head {
struct vnt_tx_buffer {
u8 byType;
u8 byPKTNO;
- u16 wTxByteCount;
+ __le16 tx_byte_count;
struct vnt_tx_fifo_head fifo_head;
union vnt_tx_head tx_head;
} __packed;
--
1.9.0


2014-03-22 09:02:23

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 02/10] staging: vt6656: rxtx s_vFillTxKey Fix pdwIV base type

Use base type __le32 and endian correct changed values.

Correct endian conversions to cpu_to_le32.

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 9f80a7a..f2f96ee 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -181,7 +181,7 @@ static void s_vFillTxKey(struct vnt_private *pDevice,
struct vnt_mic_hdr *mic_hdr)
{
u8 *pbyBuf = (u8 *)&fifo_head->adwTxKey[0];
- u32 *pdwIV = (u32 *)pbyIVHead;
+ __le32 *pdwIV = (__le32 *)pbyIVHead;
u32 *pdwExtIV = (u32 *)((u8 *)pbyIVHead + 4);
struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyHdrBuf;
__le32 rev_iv_counter;
@@ -191,7 +191,7 @@ static void s_vFillTxKey(struct vnt_private *pDevice,
return;

rev_iv_counter = cpu_to_le32(pDevice->dwIVCounter);
- *pdwIV = pDevice->dwIVCounter;
+ *pdwIV = cpu_to_le32(pDevice->dwIVCounter);
pDevice->byKeyIndex = pTransmitKey->dwKeyIndex & 0xf;

switch (pTransmitKey->byCipherSuite) {
@@ -213,9 +213,8 @@ static void s_vFillTxKey(struct vnt_private *pDevice,
memcpy(pDevice->abyPRNG, pbyBuf, 16);
}
/* Append IV after Mac Header */
- *pdwIV &= WEP_IV_MASK;
- *pdwIV |= (u32)pDevice->byKeyIndex << 30;
- *pdwIV = cpu_to_le32(*pdwIV);
+ *pdwIV &= cpu_to_le32(WEP_IV_MASK);
+ *pdwIV |= cpu_to_le32((u32)pDevice->byKeyIndex << 30);

pDevice->dwIVCounter++;
if (pDevice->dwIVCounter > WEP_IV_MASK)
@@ -256,7 +255,7 @@ static void s_vFillTxKey(struct vnt_private *pDevice,
*(pbyIVHead+3) = (u8)(((pDevice->byKeyIndex << 6) &
0xc0) | 0x20);

- *pdwIV |= cpu_to_le16((u16)(pTransmitKey->wTSC15_0));
+ *pdwIV |= cpu_to_le32((u32)(pTransmitKey->wTSC15_0));

/* Append IV&ExtIV after Mac Header */
*pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16);
--
1.9.0


2014-03-22 09:02:38

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 10/10] staging: vt6656: rxtx s_vFillCTSHead replace TYPE_CTL_CTS macro

Replace with IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS from linux/ieee80211.h
to get value of TYPE_CTL_CTS and endian correct to frame_control.

Remove old macros in tether.h

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/rxtx.c | 8 ++++++--
drivers/staging/vt6656/tether.h | 2 --
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index ac60999..1ff1446 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -742,7 +742,9 @@ static u16 s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
pDevice->tx_rate_fb1, bNeedAck, byFBOption);
/* Get CTS Frame body */
pBuf->data.duration = pBuf->duration_ba;
- pBuf->data.frame_control = TYPE_CTL_CTS;
+ pBuf->data.frame_control =
+ cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
+
memcpy(pBuf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN);

return vnt_rxtx_datahead_g_fb(pDevice, byPktType, wCurrentRate,
@@ -758,7 +760,9 @@ static u16 s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
wCurrentRate, bNeedAck, byFBOption);
/*Get CTS Frame body*/
pBuf->data.duration = pBuf->duration_ba;
- pBuf->data.frame_control = TYPE_CTL_CTS;
+ pBuf->data.frame_control =
+ cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
+
memcpy(pBuf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN);

return vnt_rxtx_datahead_g(pDevice, byPktType, wCurrentRate,
diff --git a/drivers/staging/vt6656/tether.h b/drivers/staging/vt6656/tether.h
index f42edda..f57fcfdc 100644
--- a/drivers/staging/vt6656/tether.h
+++ b/drivers/staging/vt6656/tether.h
@@ -60,7 +60,6 @@
#define TYPE_DATE_NULL 0x4800

#define TYPE_CTL_PSPOLL 0xa400
-#define TYPE_CTL_CTS 0xc400
#define TYPE_CTL_ACK 0xd400

#else //if LITTLE_ENDIAN
@@ -90,7 +89,6 @@
#define TYPE_DATE_NULL 0x0048

#define TYPE_CTL_PSPOLL 0x00a4
-#define TYPE_CTL_CTS 0x00c4
#define TYPE_CTL_ACK 0x00d4

#endif //#ifdef __BIG_ENDIAN
--
1.9.0


2014-03-22 09:02:27

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 04/10] staging: vt6656: rxtx: s_vFillTxKey fix pMACHeader sparse warning

Endian convert __le16 pMACHeader->frame_control and pMACHeader->seq_ctrl
back to cpu.

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 43e13e2..9706e18 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -282,9 +282,10 @@ static void s_vFillTxKey(struct vnt_private *pDevice,

/* MICHDR2 */
memcpy(mic_hdr->addr3, pMACHeader->addr3, ETH_ALEN);
- mic_hdr->frame_control = cpu_to_le16(pMACHeader->frame_control
- & 0xc78f);
- mic_hdr->seq_ctrl = cpu_to_le16(pMACHeader->seq_ctrl & 0xf);
+ mic_hdr->frame_control = cpu_to_le16(
+ le16_to_cpu(pMACHeader->frame_control) & 0xc78f);
+ mic_hdr->seq_ctrl = cpu_to_le16(
+ le16_to_cpu(pMACHeader->seq_ctrl) & 0xf);

if (ieee80211_has_a4(pMACHeader->frame_control))
memcpy(mic_hdr->addr4, pMACHeader->addr4, ETH_ALEN);
--
1.9.0


2014-03-22 09:02:25

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 03/10] staging: vt6656: rxtx: s_vFillTxKey Fix base type pdwExtIV

Use base type to __le32.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/rxtx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index f2f96ee..43e13e2 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -182,7 +182,7 @@ static void s_vFillTxKey(struct vnt_private *pDevice,
{
u8 *pbyBuf = (u8 *)&fifo_head->adwTxKey[0];
__le32 *pdwIV = (__le32 *)pbyIVHead;
- u32 *pdwExtIV = (u32 *)((u8 *)pbyIVHead + 4);
+ __le32 *pdwExtIV = (__le32 *)((u8 *)pbyIVHead + 4);
struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyHdrBuf;
__le32 rev_iv_counter;

--
1.9.0


2014-03-22 09:02:33

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 07/10] staging : vt6656: rxtx struct vnt_beacon_buffer Replace wTxByteCount

Replace with tx_byte_count with base type __le16

Provide endian correction in csBeacon_xmit of cbReqCount

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index c17c3da..4bb13a7 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -1697,7 +1697,7 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice,

cbReqCount = cbHeaderSize + WLAN_HDR_ADDR3_LEN + cbFrameBodySize;

- pTX_Buffer->wTxByteCount = (u16)cbReqCount;
+ pTX_Buffer->tx_byte_count = cpu_to_le16((u16)cbReqCount);
pTX_Buffer->byPKTNO = (u8) (((wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F));
pTX_Buffer->byType = 0x01;

diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h
index 0233761..779c672 100644
--- a/drivers/staging/vt6656/rxtx.h
+++ b/drivers/staging/vt6656/rxtx.h
@@ -241,7 +241,7 @@ struct vnt_tx_short_buf_head {
struct vnt_beacon_buffer {
u8 byType;
u8 byPKTNO;
- u16 wTxByteCount;
+ __le16 tx_byte_count;
struct vnt_tx_short_buf_head short_head;
struct ieee80211_hdr hdr;
} __packed;
--
1.9.0


2014-03-22 09:02:29

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 05/10] staging: vt6656: rxtx Replace struct vnt_tx_fifo_head wTimeStamp

Replace with time_stamp with base type __le16

In s_bPacketToWirelessUsb endian correct DEFAULT_MSDU_LIFETIME_RES_64us

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/rxtx.c | 6 +++---
drivers/staging/vt6656/rxtx.h | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 9706e18..1624efb 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -1008,7 +1008,7 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType,
pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK;
}

- pTxBufHead->wTimeStamp = DEFAULT_MSDU_LIFETIME_RES_64us;
+ pTxBufHead->time_stamp = cpu_to_le16(DEFAULT_MSDU_LIFETIME_RES_64us);

//Set FRAGCTL_MACHDCNT
cbMACHdLen = WLAN_HDR_ADDR3_LEN;
@@ -1431,7 +1431,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
}

pTxBufHead->wFIFOCtl |= FIFOCTL_TMOEN;
- pTxBufHead->wTimeStamp = cpu_to_le16(DEFAULT_MGN_LIFETIME_RES_64us);
+ pTxBufHead->time_stamp = cpu_to_le16(DEFAULT_MGN_LIFETIME_RES_64us);

if (is_multicast_ether_addr(pPacket->p80211Header->sA3.abyAddr1)) {
bNeedACK = false;
@@ -1800,7 +1800,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
}

pTxBufHead->wFIFOCtl |= FIFOCTL_TMOEN;
- pTxBufHead->wTimeStamp = cpu_to_le16(DEFAULT_MGN_LIFETIME_RES_64us);
+ pTxBufHead->time_stamp = cpu_to_le16(DEFAULT_MGN_LIFETIME_RES_64us);

if (is_multicast_ether_addr(p80211Header->sA3.abyAddr1)) {
bNeedACK = false;
diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h
index 6d6539d..d7e4273 100644
--- a/drivers/staging/vt6656/rxtx.h
+++ b/drivers/staging/vt6656/rxtx.h
@@ -217,7 +217,7 @@ union vnt_tx_head {
struct vnt_tx_fifo_head {
u32 adwTxKey[4];
u16 wFIFOCtl;
- u16 wTimeStamp;
+ __le16 time_stamp;
u16 wFragCtl;
u16 wReserved;
} __packed;
--
1.9.0


2014-03-22 09:02:34

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 08/10] staging: vt6656: rxtx Replace vnt_tx_fifo_head wReserved

At run time wReserved has the value of wCurrentRate.

Replace with current_rate with __le16 base type and endian correct
wCurrentRate.

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 4bb13a7..2b67b1b 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -800,7 +800,7 @@ static u16 s_vGenerateTxParameter(struct vnt_private *pDevice,
u16 wFifoCtl;
u8 byFBOption = AUTO_FB_NONE;

- pFifoHead->wReserved = wCurrentRate;
+ pFifoHead->current_rate = cpu_to_le16(wCurrentRate);
wFifoCtl = pFifoHead->wFIFOCtl;

if (wFifoCtl & FIFOCTL_AUTO_FB_0)
diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h
index 779c672..4dfb2e0 100644
--- a/drivers/staging/vt6656/rxtx.h
+++ b/drivers/staging/vt6656/rxtx.h
@@ -219,7 +219,7 @@ struct vnt_tx_fifo_head {
u16 wFIFOCtl;
__le16 time_stamp;
u16 wFragCtl;
- u16 wReserved;
+ __le16 current_rate;
} __packed;

struct vnt_tx_buffer {
--
1.9.0