2014-07-10 18:56:47

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 01/16] staging: vt6656: rxtx remove struct ethhdr from functions

ethhdr is nolonger used by driver.

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 264e3c9..998a62a 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -86,7 +86,7 @@ static struct vnt_usb_send_context *s_vGetFreeContext(struct vnt_private *);
static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
u8 byPktType, u16 wCurrentRate, struct vnt_tx_buffer *tx_buffer,
struct vnt_mic_hdr **mic_hdr, u32 need_mic, u32 cbFrameSize,
- int bNeedACK, struct ethhdr *psEthHeader, bool need_rts);
+ int bNeedACK, bool need_rts);

static unsigned int s_uGetTxRsvTime(struct vnt_private *pDevice, u8 byPktType,
u32 cbFrameLength, u16 wRate, int bNeedAck);
@@ -100,7 +100,7 @@ static u16 s_vFillCTSHead(struct vnt_usb_send_context *tx_context,

static u16 s_vFillRTSHead(struct vnt_usb_send_context *tx_context, u8 byPktType,
union vnt_tx_data_head *head, u32 cbFrameLength, int bNeedAck,
- struct ethhdr *psEthHeader, u16 wCurrentRate, u8 byFBOption);
+ u16 wCurrentRate, u8 byFBOption);

static __le16 s_uGetDataDuration(struct vnt_private *pDevice,
u8 byPktType, int bNeedAck);
@@ -425,8 +425,7 @@ static int vnt_fill_ieee80211_rts(struct vnt_usb_send_context *tx_context,
}

static u16 vnt_rxtx_rts_g_head(struct vnt_usb_send_context *tx_context,
- struct vnt_rts_g *buf, struct ethhdr *eth_hdr,
- u8 pkt_type, u32 frame_len, int need_ack,
+ struct vnt_rts_g *buf, u8 pkt_type, u32 frame_len, int need_ack,
u16 current_rate, u8 fb_option)
{
struct vnt_private *priv = tx_context->priv;
@@ -451,8 +450,7 @@ static u16 vnt_rxtx_rts_g_head(struct vnt_usb_send_context *tx_context,
}

static u16 vnt_rxtx_rts_g_fb_head(struct vnt_usb_send_context *tx_context,
- struct vnt_rts_g_fb *buf, struct ethhdr *eth_hdr,
- u8 pkt_type, u32 frame_len, int need_ack,
+ struct vnt_rts_g_fb *buf, u8 pkt_type, u32 frame_len, int need_ack,
u16 current_rate, u8 fb_option)
{
struct vnt_private *priv = tx_context->priv;
@@ -488,8 +486,7 @@ static u16 vnt_rxtx_rts_g_fb_head(struct vnt_usb_send_context *tx_context,
}

static u16 vnt_rxtx_rts_ab_head(struct vnt_usb_send_context *tx_context,
- struct vnt_rts_ab *buf, struct ethhdr *eth_hdr,
- u8 pkt_type, u32 frame_len, int need_ack,
+ struct vnt_rts_ab *buf, u8 pkt_type, u32 frame_len, int need_ack,
u16 current_rate, u8 fb_option)
{
struct vnt_private *priv = tx_context->priv;
@@ -508,8 +505,7 @@ static u16 vnt_rxtx_rts_ab_head(struct vnt_usb_send_context *tx_context,
}

static u16 vnt_rxtx_rts_a_fb_head(struct vnt_usb_send_context *tx_context,
- struct vnt_rts_a_fb *buf, struct ethhdr *eth_hdr,
- u8 pkt_type, u32 frame_len, int need_ack,
+ struct vnt_rts_a_fb *buf, u8 pkt_type, u32 frame_len, int need_ack,
u16 current_rate, u8 fb_option)
{
struct vnt_private *priv = tx_context->priv;
@@ -535,7 +531,7 @@ static u16 vnt_rxtx_rts_a_fb_head(struct vnt_usb_send_context *tx_context,

static u16 s_vFillRTSHead(struct vnt_usb_send_context *tx_context, u8 byPktType,
union vnt_tx_data_head *head, u32 cbFrameLength, int bNeedAck,
- struct ethhdr *psEthHeader, u16 wCurrentRate, u8 byFBOption)
+ u16 wCurrentRate, u8 byFBOption)
{

if (!head)
@@ -551,26 +547,26 @@ static u16 s_vFillRTSHead(struct vnt_usb_send_context *tx_context, u8 byPktType,
case PK_TYPE_11GA:
if (byFBOption == AUTO_FB_NONE)
return vnt_rxtx_rts_g_head(tx_context, &head->rts_g,
- psEthHeader, byPktType, cbFrameLength,
+ byPktType, cbFrameLength,
bNeedAck, wCurrentRate, byFBOption);
else
return vnt_rxtx_rts_g_fb_head(tx_context,
- &head->rts_g_fb, psEthHeader, byPktType,
+ &head->rts_g_fb, byPktType,
cbFrameLength, bNeedAck, wCurrentRate,
byFBOption);
break;
case PK_TYPE_11A:
if (byFBOption) {
return vnt_rxtx_rts_a_fb_head(tx_context,
- &head->rts_a_fb, psEthHeader, byPktType,
+ &head->rts_a_fb, byPktType,
cbFrameLength, bNeedAck, wCurrentRate,
byFBOption);
break;
}
case PK_TYPE_11B:
return vnt_rxtx_rts_ab_head(tx_context, &head->rts_ab,
- psEthHeader, byPktType, cbFrameLength,
- bNeedAck, wCurrentRate, byFBOption);
+ byPktType, cbFrameLength, bNeedAck,
+ wCurrentRate, byFBOption);
}

return 0;
@@ -661,7 +657,7 @@ static u16 s_vFillCTSHead(struct vnt_usb_send_context *tx_context,
static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
u8 byPktType, u16 wCurrentRate, struct vnt_tx_buffer *tx_buffer,
struct vnt_mic_hdr **mic_hdr, u32 need_mic, u32 cbFrameSize,
- int bNeedACK, struct ethhdr *psEthHeader, bool need_rts)
+ int bNeedACK, bool need_rts)
{
struct vnt_private *pDevice = tx_context->priv;
struct vnt_tx_fifo_head *pFifoHead = &tx_buffer->fifo_head;
@@ -705,7 +701,7 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,

/* Fill RTS */
return s_vFillRTSHead(tx_context, byPktType, head,
- cbFrameSize, bNeedACK, psEthHeader,
+ cbFrameSize, bNeedACK,
wCurrentRate, byFBOption);

} else {
@@ -754,8 +750,8 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,

/* Fill RTS */
return s_vFillRTSHead(tx_context, byPktType, head,
- cbFrameSize, bNeedACK, psEthHeader,
- wCurrentRate, byFBOption);
+ cbFrameSize, bNeedACK,
+ wCurrentRate, byFBOption);
} else {
struct vnt_rrv_time_ab *pBuf = &tx_buffer->
tx_head.tx_ab.ab;
@@ -789,8 +785,8 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,

/* Fill RTS */
return s_vFillRTSHead(tx_context, byPktType, head,
- cbFrameSize,
- bNeedACK, psEthHeader, wCurrentRate, byFBOption);
+ cbFrameSize, bNeedACK,
+ wCurrentRate, byFBOption);
} else {
struct vnt_rrv_time_ab *pBuf = &tx_buffer->
tx_head.tx_ab.ab;
@@ -1025,7 +1021,7 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb)

duration_id = s_vGenerateTxParameter(tx_context, pkt_type, current_rate,
tx_buffer, &mic_hdr, need_mic, frame_size,
- need_ack, NULL, need_rts);
+ need_ack, need_rts);

tx_header_size = tx_context->tx_hdr_size;
if (!tx_header_size) {
--
1.9.1



2014-07-10 18:56:57

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 08/16] staging: vt6656: s_vGenerateTxParameter parse out vnt_rrv_time_ab

create new function vnt_rxtx_ab which will eventually carry onward
functions

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index bad2fe4..758f69e 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -669,6 +669,28 @@ static u16 vnt_rxtx_cts(struct vnt_usb_send_context *tx_context,
return 0;
}

+static u16 vnt_rxtx_ab(struct vnt_usb_send_context *tx_context,
+ union vnt_tx_head *tx_head, u8 pkt_type, u32 frame_size,
+ int need_ack, u16 current_rate, bool need_rts)
+{
+ struct vnt_private *priv = tx_context->priv;
+ struct vnt_rrv_time_ab *buf = &tx_head->tx_ab.ab;
+
+ buf->rrv_time = vnt_rxtx_rsvtime_le16(priv, pkt_type,
+ frame_size, current_rate, need_ack);
+
+ if (need_rts) {
+ if (pkt_type == PK_TYPE_11B)
+ buf->rts_rrv_time = s_uGetRTSCTSRsvTime(priv, 0,
+ pkt_type, frame_size, current_rate);
+ else /* PK_TYPE_11A */
+ buf->rts_rrv_time = s_uGetRTSCTSRsvTime(priv, 2,
+ pkt_type, frame_size, current_rate);
+ }
+
+ return 0;
+}
+
/*+
*
* Description:
@@ -696,7 +718,6 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
struct vnt_mic_hdr **mic_hdr, u32 need_mic, u32 cbFrameSize,
int bNeedACK, bool need_rts)
{
- struct vnt_private *pDevice = tx_context->priv;
union vnt_tx_data_head *head = NULL;

if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
@@ -742,26 +763,17 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
}

if (need_rts) {
- struct vnt_rrv_time_ab *pBuf = &tx_buffer->
- tx_head.tx_ab.ab;
-
- pBuf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 2,
- byPktType, cbFrameSize, wCurrentRate);
+ vnt_rxtx_ab(tx_context, &tx_buffer->tx_head, byPktType,
+ cbFrameSize, bNeedACK, wCurrentRate, need_rts);

- pBuf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice,
- byPktType, cbFrameSize, wCurrentRate, bNeedACK);

/* Fill RTS */
return s_vFillRTSHead(tx_context, byPktType, head,
cbFrameSize, bNeedACK,
wCurrentRate);
} else {
- struct vnt_rrv_time_ab *pBuf = &tx_buffer->
- tx_head.tx_ab.ab;
-
- pBuf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice,
- byPktType, cbFrameSize,
- wCurrentRate, bNeedACK);
+ vnt_rxtx_ab(tx_context, &tx_buffer->tx_head, byPktType,
+ cbFrameSize, bNeedACK, wCurrentRate, need_rts);

return vnt_rxtx_datahead_a_fb(tx_context, byPktType,
wCurrentRate, &head->data_head_a_fb,
@@ -776,27 +788,16 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
}

if (need_rts) {
- struct vnt_rrv_time_ab *pBuf = &tx_buffer->
- tx_head.tx_ab.ab;
-
- pBuf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 0,
- byPktType, cbFrameSize, wCurrentRate);
-
- pBuf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice,
- byPktType, cbFrameSize, wCurrentRate,
- bNeedACK);
+ vnt_rxtx_ab(tx_context, &tx_buffer->tx_head, byPktType,
+ cbFrameSize, bNeedACK, wCurrentRate, need_rts);

/* Fill RTS */
return s_vFillRTSHead(tx_context, byPktType, head,
cbFrameSize, bNeedACK,
wCurrentRate);
} else {
- struct vnt_rrv_time_ab *pBuf = &tx_buffer->
- tx_head.tx_ab.ab;
-
- pBuf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice,
- byPktType, cbFrameSize,
- wCurrentRate, bNeedACK);
+ vnt_rxtx_ab(tx_context, &tx_buffer->tx_head, byPktType,
+ cbFrameSize, bNeedACK, wCurrentRate, need_rts);

return vnt_rxtx_datahead_ab(tx_context, byPktType,
wCurrentRate, &head->data_head_ab,
--
1.9.1


2014-07-10 18:57:12

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 16/16] staging: vt6656: rename s_vFillCTSHead to vnt_fill_cts_head

Removing static declaration.

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index dce6cb5..f8c2323 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -33,7 +33,7 @@
* s_uGetRTSCTSDuration- get rtx/cts required duration
* s_uGetRTSCTSRsvTime- get rts/cts reserved time
* s_uGetTxRsvTime- get frame reserved time
- * s_vFillCTSHead- fulfill CTS ctl header
+ * vnt_fill_cts_head- fulfill CTS ctl header
* s_vFillFragParameter- Set fragment ctl parameter.
* s_vFillRTSHead- fulfill RTS ctl header
* vDMA0_tx_80211- tx 802.11 frame via dma0
@@ -89,10 +89,6 @@ static unsigned int s_uGetTxRsvTime(struct vnt_private *pDevice, u8 byPktType,
static __le16 s_uGetRTSCTSRsvTime(struct vnt_private *priv,
u8 rsv_type, u8 pkt_type, u32 frame_length, u16 current_rate);

-static u16 s_vFillCTSHead(struct vnt_usb_send_context *tx_context,
- u8 byPktType, union vnt_tx_data_head *head, u32 cbFrameLength,
- int bNeedAck, u16 wCurrentRate);
-
static __le16 s_uGetDataDuration(struct vnt_private *pDevice,
u8 byPktType, int bNeedAck);

@@ -519,7 +515,7 @@ static u16 vnt_rxtx_rts_a_fb_head(struct vnt_usb_send_context *tx_context,
&buf->data_head, frame_len, need_ack);
}

-static u16 s_vFillCTSHead(struct vnt_usb_send_context *tx_context,
+static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
u8 pkt_type, union vnt_tx_data_head *head, u32 frame_len,
int need_ack, u16 current_rate)
{
@@ -631,7 +627,7 @@ static u16 vnt_rxtx_cts(struct vnt_usb_send_context *tx_context,
head = &tx_head->tx_cts.tx.mic.head;

/* Fill CTS */
- return s_vFillCTSHead(tx_context, pkt_type, head, frame_size,
+ return vnt_fill_cts_head(tx_context, pkt_type, head, frame_size,
need_ack, current_rate);
}

--
1.9.1


2014-07-10 18:56:59

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 09/16] staging: vt6656: merge PK_TYPE_11GB and PK_TYPE_11GA into vnt_rxtx_rts

add to vnt_rxtx_rts calls from s_vFillRTSHead.

add need_mic and union vnt_tx_data_head head positions from s_vGenerateTxParameter.

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 758f69e..0ff8b50 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -542,17 +542,6 @@ static u16 s_vFillRTSHead(struct vnt_usb_send_context *tx_context, u8 byPktType,
* Otherwise, we need to modified codes for them.
*/
switch (byPktType) {
- case PK_TYPE_11GB:
- case PK_TYPE_11GA:
- if (!tx_context->fb_option)
- return vnt_rxtx_rts_g_head(tx_context, &head->rts_g,
- byPktType, cbFrameLength,
- bNeedAck, wCurrentRate);
- else
- return vnt_rxtx_rts_g_fb_head(tx_context,
- &head->rts_g_fb, byPktType,
- cbFrameLength, bNeedAck, wCurrentRate);
- break;
case PK_TYPE_11A:
if (tx_context->fb_option) {
return vnt_rxtx_rts_a_fb_head(tx_context,
@@ -631,10 +620,11 @@ static u16 s_vFillCTSHead(struct vnt_usb_send_context *tx_context,

static u16 vnt_rxtx_rts(struct vnt_usb_send_context *tx_context,
union vnt_tx_head *tx_head, u8 pkt_type, u32 frame_size,
- int need_ack, u16 current_rate)
+ int need_ack, u16 current_rate, bool need_mic)
{
struct vnt_private *priv = tx_context->priv;
struct vnt_rrv_time_rts *buf = &tx_head->tx_rts.rts;
+ union vnt_tx_data_head *head = &tx_head->tx_rts.tx.head;

buf->rts_rrv_time_aa = s_uGetRTSCTSRsvTime(priv, 2,
pkt_type, frame_size, current_rate);
@@ -648,7 +638,15 @@ static u16 vnt_rxtx_rts(struct vnt_usb_send_context *tx_context,
buf->rrv_time_b = vnt_rxtx_rsvtime_le16(priv, PK_TYPE_11B, frame_size,
priv->byTopCCKBasicRate, need_ack);

- return 0;
+ if (need_mic)
+ head = &tx_head->tx_rts.tx.mic.head;
+
+ if (tx_context->fb_option)
+ return vnt_rxtx_rts_g_fb_head(tx_context, &head->rts_g_fb,
+ pkt_type, frame_size, need_ack, current_rate);
+
+ return vnt_rxtx_rts_g_head(tx_context, &head->rts_g,
+ pkt_type, frame_size, need_ack, current_rate);
}

static u16 vnt_rxtx_cts(struct vnt_usb_send_context *tx_context,
@@ -722,22 +720,13 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,

if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
if (need_rts) {
- vnt_rxtx_rts(tx_context, &tx_buffer->tx_head,
- byPktType, cbFrameSize, bNeedACK, wCurrentRate);
-
- if (need_mic) {
+ if (need_mic)
*mic_hdr = &tx_buffer->
tx_head.tx_rts.tx.mic.hdr;
- head = &tx_buffer->tx_head.tx_rts.tx.mic.head;
- } else {
- head = &tx_buffer->tx_head.tx_rts.tx.head;
- }
-
- /* Fill RTS */
- return s_vFillRTSHead(tx_context, byPktType, head,
- cbFrameSize, bNeedACK,
- wCurrentRate);

+ return vnt_rxtx_rts(tx_context, &tx_buffer->tx_head,
+ byPktType, cbFrameSize, bNeedACK,
+ wCurrentRate, need_mic);
} else {
vnt_rxtx_cts(tx_context, &tx_buffer->tx_head,
byPktType, cbFrameSize, bNeedACK, wCurrentRate);
--
1.9.1


2014-07-10 18:56:52

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 05/16] staging: vt6656: s_vGenerateTxParameter Parse out struct vnt_rrv_time_rts

Creat new function vnt_rxtx_rts that will eventually carry onward
functions.

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 2ed045d..7d0b74c 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -629,6 +629,28 @@ static u16 s_vFillCTSHead(struct vnt_usb_send_context *tx_context,
return 0;
}

+static u16 vnt_rxtx_rts(struct vnt_usb_send_context *tx_context,
+ union vnt_tx_head *tx_head, u8 pkt_type, u32 frame_size,
+ int need_ack, u16 current_rate)
+{
+ struct vnt_private *priv = tx_context->priv;
+ struct vnt_rrv_time_rts *buf = &tx_head->tx_rts.rts;
+
+ buf->rts_rrv_time_aa = s_uGetRTSCTSRsvTime(priv, 2,
+ pkt_type, frame_size, current_rate);
+ buf->rts_rrv_time_ba = s_uGetRTSCTSRsvTime(priv, 1,
+ pkt_type, frame_size, current_rate);
+ buf->rts_rrv_time_bb = s_uGetRTSCTSRsvTime(priv, 0,
+ pkt_type, frame_size, current_rate);
+
+ buf->rrv_time_a = vnt_rxtx_rsvtime_le16(priv, pkt_type, frame_size,
+ current_rate, need_ack);
+ buf->rrv_time_b = vnt_rxtx_rsvtime_le16(priv, PK_TYPE_11B, frame_size,
+ priv->byTopCCKBasicRate, need_ack);
+
+ return 0;
+}
+
/*+
*
* Description:
@@ -661,21 +683,8 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,

if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
if (need_rts) {
- struct vnt_rrv_time_rts *pBuf =
- &tx_buffer->tx_head.tx_rts.rts;
-
- pBuf->rts_rrv_time_aa = s_uGetRTSCTSRsvTime(pDevice, 2,
- byPktType, cbFrameSize, wCurrentRate);
- pBuf->rts_rrv_time_ba = s_uGetRTSCTSRsvTime(pDevice, 1,
- byPktType, cbFrameSize, wCurrentRate);
- pBuf->rts_rrv_time_bb = s_uGetRTSCTSRsvTime(pDevice, 0,
- byPktType, cbFrameSize, wCurrentRate);
-
- pBuf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice,
- byPktType, cbFrameSize, wCurrentRate, bNeedACK);
- pBuf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice,
- PK_TYPE_11B, cbFrameSize,
- pDevice->byTopCCKBasicRate, bNeedACK);
+ vnt_rxtx_rts(tx_context, &tx_buffer->tx_head,
+ byPktType, cbFrameSize, bNeedACK, wCurrentRate);

if (need_mic) {
*mic_hdr = &tx_buffer->
--
1.9.1


2014-07-10 18:56:56

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 07/16] staging: vt6656: s_vGenerateTxParameter rxtx.c s_vGenerateTxParameter pBuf->rrv_time always the calling pkt_type

Use byPktType instead of macro.

The pkt_type has already been filtered in this function so its always set
to the correct one.

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 49bda3c..bad2fe4 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -760,7 +760,7 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
tx_head.tx_ab.ab;

pBuf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice,
- PK_TYPE_11A, cbFrameSize,
+ byPktType, cbFrameSize,
wCurrentRate, bNeedACK);

return vnt_rxtx_datahead_a_fb(tx_context, byPktType,
@@ -783,7 +783,7 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
byPktType, cbFrameSize, wCurrentRate);

pBuf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice,
- PK_TYPE_11B, cbFrameSize, wCurrentRate,
+ byPktType, cbFrameSize, wCurrentRate,
bNeedACK);

/* Fill RTS */
@@ -795,7 +795,7 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
tx_head.tx_ab.ab;

pBuf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice,
- PK_TYPE_11B, cbFrameSize,
+ byPktType, cbFrameSize,
wCurrentRate, bNeedACK);

return vnt_rxtx_datahead_ab(tx_context, byPktType,
--
1.9.1


2014-07-10 18:56:50

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 02/16] staging: vt6656: rxtx: move tx_context->fb_option into function structure.

Replace fb_option in function calls with tx_context->fb_option.

Namely functions s_vFillCTSHead and s_vFillRTSHead

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 998a62a..a556d81 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -545,7 +545,7 @@ static u16 s_vFillRTSHead(struct vnt_usb_send_context *tx_context, u8 byPktType,
switch (byPktType) {
case PK_TYPE_11GB:
case PK_TYPE_11GA:
- if (byFBOption == AUTO_FB_NONE)
+ if (!tx_context->fb_option)
return vnt_rxtx_rts_g_head(tx_context, &head->rts_g,
byPktType, cbFrameLength,
bNeedAck, wCurrentRate, byFBOption);
@@ -556,7 +556,7 @@ static u16 s_vFillRTSHead(struct vnt_usb_send_context *tx_context, u8 byPktType,
byFBOption);
break;
case PK_TYPE_11A:
- if (byFBOption) {
+ if (tx_context->fb_option) {
return vnt_rxtx_rts_a_fb_head(tx_context,
&head->rts_a_fb, byPktType,
cbFrameLength, bNeedAck, wCurrentRate,
@@ -582,7 +582,7 @@ static u16 s_vFillCTSHead(struct vnt_usb_send_context *tx_context,
if (!head)
return 0;

- if (byFBOption != AUTO_FB_NONE) {
+ if (tx_context->fb_option) {
/* Auto Fall back */
struct vnt_cts_fb *pBuf = &head->cts_g_fb;
/* Get SignalField,ServiceField,Length */
--
1.9.1


2014-07-10 18:57:05

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 12/16] staging: vt6656: s_vGenerateTxParameter remove else from if statements

The function returns out at if statements so drop else.

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 6113807..0d0a956 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -717,25 +717,20 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
return vnt_rxtx_rts(tx_context, &tx_buffer->tx_head,
byPktType, cbFrameSize, bNeedACK,
wCurrentRate, need_mic);
- } else {
- if (need_mic)
- *mic_hdr = &tx_buffer->
- tx_head.tx_cts.tx.mic.hdr;
-
- return vnt_rxtx_cts(tx_context, &tx_buffer->tx_head,
- byPktType, cbFrameSize, bNeedACK,
- wCurrentRate, need_mic);
}
- } else {
+
if (need_mic)
- *mic_hdr = &tx_buffer->tx_head.tx_ab.tx.mic.hdr;
+ *mic_hdr = &tx_buffer->tx_head.tx_cts.tx.mic.hdr;

- return vnt_rxtx_ab(tx_context, &tx_buffer->tx_head,
- byPktType, cbFrameSize, bNeedACK,
- wCurrentRate, need_rts, need_mic);
+ return vnt_rxtx_cts(tx_context, &tx_buffer->tx_head, byPktType,
+ cbFrameSize, bNeedACK, wCurrentRate, need_mic);
}

- return 0;
+ if (need_mic)
+ *mic_hdr = &tx_buffer->tx_head.tx_ab.tx.mic.hdr;
+
+ return vnt_rxtx_ab(tx_context, &tx_buffer->tx_head, byPktType,
+ cbFrameSize, bNeedACK, wCurrentRate, need_rts, need_mic);
}

static void vnt_fill_txkey(struct vnt_usb_send_context *tx_context,
--
1.9.1


2014-07-10 18:57:10

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 14/16] staging: vt6656: rename s_vGenerateTxParameter to vnt_generate_tx_parameter

Removing static declaration

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 1ff16e2..ad1a1b6 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -25,7 +25,7 @@
* Date: May 20, 2003
*
* Functions:
- * s_vGenerateTxParameter - Generate tx dma required parameter.
+ * vnt_generate_tx_parameter - Generate tx dma required parameter.
* csBeacon_xmit - beacon tx function
* csMgmt_xmit - management tx function
* s_uGetDataDuration - get tx data required duration
@@ -83,11 +83,6 @@ static const u16 wFB_Opt1[2][5] = {

static struct vnt_usb_send_context *s_vGetFreeContext(struct vnt_private *);

-static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
- u8 byPktType, u16 wCurrentRate, struct vnt_tx_buffer *tx_buffer,
- struct vnt_mic_hdr **mic_hdr, u32 need_mic, u32 cbFrameSize,
- int bNeedACK, bool need_rts);
-
static unsigned int s_uGetTxRsvTime(struct vnt_private *pDevice, u8 byPktType,
u32 cbFrameLength, u16 wRate, int bNeedAck);

@@ -702,7 +697,7 @@ static u16 vnt_rxtx_ab(struct vnt_usb_send_context *tx_context,
*
-*/

-static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
+static u16 vnt_generate_tx_parameter(struct vnt_usb_send_context *tx_context,
u8 pkt_type, u16 current_rate, struct vnt_tx_buffer *tx_buffer,
struct vnt_mic_hdr **mic_hdr, u32 need_mic, u32 frame_size,
int need_ack, bool need_rts)
@@ -950,8 +945,8 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb)

tx_context->fb_option = fb_option;

- duration_id = s_vGenerateTxParameter(tx_context, pkt_type, current_rate,
- tx_buffer, &mic_hdr, need_mic, frame_size,
+ duration_id = vnt_generate_tx_parameter(tx_context, pkt_type,
+ current_rate, tx_buffer, &mic_hdr, need_mic, frame_size,
need_ack, need_rts);

tx_header_size = tx_context->tx_hdr_size;
--
1.9.1


2014-07-10 18:57:08

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 13/16] staging: vt6656: s_vGenerateTxParameter remove camel case

Camel case changes
byPktType -> pkt_type
wCurrentRate -> current_rate
cbFrameSize -> frame_size
bNeedACK -> need_ack

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 0d0a956..1ff16e2 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -703,34 +703,34 @@ static u16 vnt_rxtx_ab(struct vnt_usb_send_context *tx_context,
-*/

static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
- u8 byPktType, u16 wCurrentRate, struct vnt_tx_buffer *tx_buffer,
- struct vnt_mic_hdr **mic_hdr, u32 need_mic, u32 cbFrameSize,
- int bNeedACK, bool need_rts)
+ u8 pkt_type, u16 current_rate, struct vnt_tx_buffer *tx_buffer,
+ struct vnt_mic_hdr **mic_hdr, u32 need_mic, u32 frame_size,
+ int need_ack, bool need_rts)
{

- if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
+ if (pkt_type == PK_TYPE_11GB || pkt_type == PK_TYPE_11GA) {
if (need_rts) {
if (need_mic)
*mic_hdr = &tx_buffer->
tx_head.tx_rts.tx.mic.hdr;

return vnt_rxtx_rts(tx_context, &tx_buffer->tx_head,
- byPktType, cbFrameSize, bNeedACK,
- wCurrentRate, need_mic);
+ pkt_type, frame_size, need_ack,
+ current_rate, need_mic);
}

if (need_mic)
*mic_hdr = &tx_buffer->tx_head.tx_cts.tx.mic.hdr;

- return vnt_rxtx_cts(tx_context, &tx_buffer->tx_head, byPktType,
- cbFrameSize, bNeedACK, wCurrentRate, need_mic);
+ return vnt_rxtx_cts(tx_context, &tx_buffer->tx_head, pkt_type,
+ frame_size, need_ack, current_rate, need_mic);
}

if (need_mic)
*mic_hdr = &tx_buffer->tx_head.tx_ab.tx.mic.hdr;

- return vnt_rxtx_ab(tx_context, &tx_buffer->tx_head, byPktType,
- cbFrameSize, bNeedACK, wCurrentRate, need_rts, need_mic);
+ return vnt_rxtx_ab(tx_context, &tx_buffer->tx_head, pkt_type,
+ frame_size, need_ack, current_rate, need_rts, need_mic);
}

static void vnt_fill_txkey(struct vnt_usb_send_context *tx_context,
--
1.9.1


2014-07-10 18:57:11

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 15/16] staging: vt6656: s_vFillCTSHead remove camel case

Camel case changes
byPktType -> pkt_type
cbFrameLength -> frame_len
bNeedAck -> need_ack
pDevice -> priv
uCTSFrameLen -> cts_frame_len

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index ad1a1b6..dce6cb5 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -520,60 +520,60 @@ static u16 vnt_rxtx_rts_a_fb_head(struct vnt_usb_send_context *tx_context,
}

static u16 s_vFillCTSHead(struct vnt_usb_send_context *tx_context,
- u8 byPktType, union vnt_tx_data_head *head, u32 cbFrameLength,
- int bNeedAck, u16 wCurrentRate)
+ u8 pkt_type, union vnt_tx_data_head *head, u32 frame_len,
+ int need_ack, u16 current_rate)
{
- struct vnt_private *pDevice = tx_context->priv;
- u32 uCTSFrameLen = 14;
+ struct vnt_private *priv = tx_context->priv;
+ u32 cts_frame_len = 14;

if (!head)
return 0;

if (tx_context->fb_option) {
/* Auto Fall back */
- struct vnt_cts_fb *pBuf = &head->cts_g_fb;
+ struct vnt_cts_fb *buf = &head->cts_g_fb;
/* Get SignalField,ServiceField,Length */
- vnt_get_phy_field(pDevice, uCTSFrameLen,
- pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b);
- pBuf->duration_ba = s_uGetRTSCTSDuration(pDevice, CTSDUR_BA,
- cbFrameLength, byPktType,
- wCurrentRate, bNeedAck);
+ vnt_get_phy_field(priv, cts_frame_len,
+ priv->byTopCCKBasicRate, PK_TYPE_11B, &buf->b);
+ buf->duration_ba = s_uGetRTSCTSDuration(priv, CTSDUR_BA,
+ frame_len, pkt_type,
+ current_rate, need_ack);
/* Get CTSDuration_ba_f0 */
- pBuf->cts_duration_ba_f0 = s_uGetRTSCTSDuration(pDevice,
- CTSDUR_BA_F0, cbFrameLength, byPktType,
- pDevice->tx_rate_fb0, bNeedAck);
+ buf->cts_duration_ba_f0 = s_uGetRTSCTSDuration(priv,
+ CTSDUR_BA_F0, frame_len, pkt_type,
+ priv->tx_rate_fb0, need_ack);
/* Get CTSDuration_ba_f1 */
- pBuf->cts_duration_ba_f1 = s_uGetRTSCTSDuration(pDevice,
- CTSDUR_BA_F1, cbFrameLength, byPktType,
- pDevice->tx_rate_fb1, bNeedAck);
+ buf->cts_duration_ba_f1 = s_uGetRTSCTSDuration(priv,
+ CTSDUR_BA_F1, frame_len, pkt_type,
+ priv->tx_rate_fb1, need_ack);
/* Get CTS Frame body */
- pBuf->data.duration = pBuf->duration_ba;
- pBuf->data.frame_control =
+ buf->data.duration = buf->duration_ba;
+ buf->data.frame_control =
cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);

- memcpy(pBuf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN);
+ memcpy(buf->data.ra, priv->abyCurrentNetAddr, ETH_ALEN);

- return vnt_rxtx_datahead_g_fb(tx_context, byPktType,
- wCurrentRate, &pBuf->data_head, cbFrameLength,
- bNeedAck);
+ return vnt_rxtx_datahead_g_fb(tx_context, pkt_type,
+ current_rate, &buf->data_head, frame_len,
+ need_ack);
} else {
- struct vnt_cts *pBuf = &head->cts_g;
+ struct vnt_cts *buf = &head->cts_g;
/* Get SignalField,ServiceField,Length */
- vnt_get_phy_field(pDevice, uCTSFrameLen,
- pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b);
+ vnt_get_phy_field(priv, cts_frame_len,
+ priv->byTopCCKBasicRate, PK_TYPE_11B, &buf->b);
/* Get CTSDuration_ba */
- pBuf->duration_ba = s_uGetRTSCTSDuration(pDevice,
- CTSDUR_BA, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck);
+ buf->duration_ba = s_uGetRTSCTSDuration(priv,
+ CTSDUR_BA, frame_len, pkt_type,
+ current_rate, need_ack);
/*Get CTS Frame body*/
- pBuf->data.duration = pBuf->duration_ba;
- pBuf->data.frame_control =
+ buf->data.duration = buf->duration_ba;
+ buf->data.frame_control =
cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);

- memcpy(pBuf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN);
+ memcpy(buf->data.ra, priv->abyCurrentNetAddr, ETH_ALEN);

- return vnt_rxtx_datahead_g(tx_context, byPktType, wCurrentRate,
- &pBuf->data_head, cbFrameLength, bNeedAck);
+ return vnt_rxtx_datahead_g(tx_context, pkt_type, current_rate,
+ &buf->data_head, frame_len, need_ack);
}

return 0;
--
1.9.1


2014-07-10 18:56:52

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 03/16] staging: vt6656: rxtx remove fb_option from functions.

This is now dead code.

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index a556d81..57e1dff 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -96,18 +96,18 @@ static __le16 s_uGetRTSCTSRsvTime(struct vnt_private *priv,

static u16 s_vFillCTSHead(struct vnt_usb_send_context *tx_context,
u8 byPktType, union vnt_tx_data_head *head, u32 cbFrameLength,
- int bNeedAck, u16 wCurrentRate, u8 byFBOption);
+ int bNeedAck, u16 wCurrentRate);

static u16 s_vFillRTSHead(struct vnt_usb_send_context *tx_context, u8 byPktType,
union vnt_tx_data_head *head, u32 cbFrameLength, int bNeedAck,
- u16 wCurrentRate, u8 byFBOption);
+ u16 wCurrentRate);

static __le16 s_uGetDataDuration(struct vnt_private *pDevice,
u8 byPktType, int bNeedAck);

static __le16 s_uGetRTSCTSDuration(struct vnt_private *pDevice,
u8 byDurType, u32 cbFrameLength, u8 byPktType, u16 wRate,
- int bNeedAck, u8 byFBOption);
+ int bNeedAck);

static struct vnt_usb_send_context
*s_vGetFreeContext(struct vnt_private *priv)
@@ -243,8 +243,7 @@ static __le16 s_uGetDataDuration(struct vnt_private *pDevice,

//byFreqType: 0=>5GHZ 1=>2.4GHZ
static __le16 s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType,
- u32 cbFrameLength, u8 byPktType, u16 wRate, int bNeedAck,
- u8 byFBOption)
+ u32 cbFrameLength, u8 byPktType, u16 wRate, int bNeedAck)
{
u32 uCTSTime = 0, uDurTime = 0;

@@ -426,7 +425,7 @@ static int vnt_fill_ieee80211_rts(struct vnt_usb_send_context *tx_context,

static u16 vnt_rxtx_rts_g_head(struct vnt_usb_send_context *tx_context,
struct vnt_rts_g *buf, u8 pkt_type, u32 frame_len, int need_ack,
- u16 current_rate, u8 fb_option)
+ u16 current_rate)
{
struct vnt_private *priv = tx_context->priv;
u16 rts_frame_len = 20;
@@ -437,11 +436,11 @@ static u16 vnt_rxtx_rts_g_head(struct vnt_usb_send_context *tx_context,
priv->byTopOFDMBasicRate, pkt_type, &buf->a);

buf->duration_bb = s_uGetRTSCTSDuration(priv, RTSDUR_BB, frame_len,
- PK_TYPE_11B, priv->byTopCCKBasicRate, need_ack, fb_option);
+ PK_TYPE_11B, priv->byTopCCKBasicRate, need_ack);
buf->duration_aa = s_uGetRTSCTSDuration(priv, RTSDUR_AA, frame_len,
- pkt_type, current_rate, need_ack, fb_option);
+ pkt_type, current_rate, need_ack);
buf->duration_ba = s_uGetRTSCTSDuration(priv, RTSDUR_BA, frame_len,
- pkt_type, current_rate, need_ack, fb_option);
+ pkt_type, current_rate, need_ack);

vnt_fill_ieee80211_rts(tx_context, &buf->data, buf->duration_aa);

@@ -451,7 +450,7 @@ static u16 vnt_rxtx_rts_g_head(struct vnt_usb_send_context *tx_context,

static u16 vnt_rxtx_rts_g_fb_head(struct vnt_usb_send_context *tx_context,
struct vnt_rts_g_fb *buf, u8 pkt_type, u32 frame_len, int need_ack,
- u16 current_rate, u8 fb_option)
+ u16 current_rate)
{
struct vnt_private *priv = tx_context->priv;
u16 rts_frame_len = 20;
@@ -463,21 +462,21 @@ static u16 vnt_rxtx_rts_g_fb_head(struct vnt_usb_send_context *tx_context,


buf->duration_bb = s_uGetRTSCTSDuration(priv, RTSDUR_BB, frame_len,
- PK_TYPE_11B, priv->byTopCCKBasicRate, need_ack, fb_option);
+ PK_TYPE_11B, priv->byTopCCKBasicRate, need_ack);
buf->duration_aa = s_uGetRTSCTSDuration(priv, RTSDUR_AA, frame_len,
- pkt_type, current_rate, need_ack, fb_option);
+ pkt_type, current_rate, need_ack);
buf->duration_ba = s_uGetRTSCTSDuration(priv, RTSDUR_BA, frame_len,
- pkt_type, current_rate, need_ack, fb_option);
+ pkt_type, current_rate, need_ack);


buf->rts_duration_ba_f0 = s_uGetRTSCTSDuration(priv, RTSDUR_BA_F0,
- frame_len, pkt_type, priv->tx_rate_fb0, need_ack, fb_option);
+ frame_len, pkt_type, priv->tx_rate_fb0, need_ack);
buf->rts_duration_aa_f0 = s_uGetRTSCTSDuration(priv, RTSDUR_AA_F0,
- frame_len, pkt_type, priv->tx_rate_fb0, need_ack, fb_option);
+ frame_len, pkt_type, priv->tx_rate_fb0, need_ack);
buf->rts_duration_ba_f1 = s_uGetRTSCTSDuration(priv, RTSDUR_BA_F1,
- frame_len, pkt_type, priv->tx_rate_fb1, need_ack, fb_option);
+ frame_len, pkt_type, priv->tx_rate_fb1, need_ack);
buf->rts_duration_aa_f1 = s_uGetRTSCTSDuration(priv, RTSDUR_AA_F1,
- frame_len, pkt_type, priv->tx_rate_fb1, need_ack, fb_option);
+ frame_len, pkt_type, priv->tx_rate_fb1, need_ack);

vnt_fill_ieee80211_rts(tx_context, &buf->data, buf->duration_aa);

@@ -487,7 +486,7 @@ static u16 vnt_rxtx_rts_g_fb_head(struct vnt_usb_send_context *tx_context,

static u16 vnt_rxtx_rts_ab_head(struct vnt_usb_send_context *tx_context,
struct vnt_rts_ab *buf, u8 pkt_type, u32 frame_len, int need_ack,
- u16 current_rate, u8 fb_option)
+ u16 current_rate)
{
struct vnt_private *priv = tx_context->priv;
u16 rts_frame_len = 20;
@@ -496,7 +495,7 @@ static u16 vnt_rxtx_rts_ab_head(struct vnt_usb_send_context *tx_context,
priv->byTopOFDMBasicRate, pkt_type, &buf->ab);

buf->duration = s_uGetRTSCTSDuration(priv, RTSDUR_AA, frame_len,
- pkt_type, current_rate, need_ack, fb_option);
+ pkt_type, current_rate, need_ack);

vnt_fill_ieee80211_rts(tx_context, &buf->data, buf->duration);

@@ -506,7 +505,7 @@ static u16 vnt_rxtx_rts_ab_head(struct vnt_usb_send_context *tx_context,

static u16 vnt_rxtx_rts_a_fb_head(struct vnt_usb_send_context *tx_context,
struct vnt_rts_a_fb *buf, u8 pkt_type, u32 frame_len, int need_ack,
- u16 current_rate, u8 fb_option)
+ u16 current_rate)
{
struct vnt_private *priv = tx_context->priv;
u16 rts_frame_len = 20;
@@ -515,13 +514,13 @@ static u16 vnt_rxtx_rts_a_fb_head(struct vnt_usb_send_context *tx_context,
priv->byTopOFDMBasicRate, pkt_type, &buf->a);

buf->duration = s_uGetRTSCTSDuration(priv, RTSDUR_AA, frame_len,
- pkt_type, current_rate, need_ack, fb_option);
+ pkt_type, current_rate, need_ack);

buf->rts_duration_f0 = s_uGetRTSCTSDuration(priv, RTSDUR_AA_F0,
- frame_len, pkt_type, priv->tx_rate_fb0, need_ack, fb_option);
+ frame_len, pkt_type, priv->tx_rate_fb0, need_ack);

buf->rts_duration_f1 = s_uGetRTSCTSDuration(priv, RTSDUR_AA_F1,
- frame_len, pkt_type, priv->tx_rate_fb1, need_ack, fb_option);
+ frame_len, pkt_type, priv->tx_rate_fb1, need_ack);

vnt_fill_ieee80211_rts(tx_context, &buf->data, buf->duration);

@@ -531,7 +530,7 @@ static u16 vnt_rxtx_rts_a_fb_head(struct vnt_usb_send_context *tx_context,

static u16 s_vFillRTSHead(struct vnt_usb_send_context *tx_context, u8 byPktType,
union vnt_tx_data_head *head, u32 cbFrameLength, int bNeedAck,
- u16 wCurrentRate, u8 byFBOption)
+ u16 wCurrentRate)
{

if (!head)
@@ -548,25 +547,23 @@ static u16 s_vFillRTSHead(struct vnt_usb_send_context *tx_context, u8 byPktType,
if (!tx_context->fb_option)
return vnt_rxtx_rts_g_head(tx_context, &head->rts_g,
byPktType, cbFrameLength,
- bNeedAck, wCurrentRate, byFBOption);
+ bNeedAck, wCurrentRate);
else
return vnt_rxtx_rts_g_fb_head(tx_context,
&head->rts_g_fb, byPktType,
- cbFrameLength, bNeedAck, wCurrentRate,
- byFBOption);
+ cbFrameLength, bNeedAck, wCurrentRate);
break;
case PK_TYPE_11A:
if (tx_context->fb_option) {
return vnt_rxtx_rts_a_fb_head(tx_context,
&head->rts_a_fb, byPktType,
- cbFrameLength, bNeedAck, wCurrentRate,
- byFBOption);
+ cbFrameLength, bNeedAck, wCurrentRate);
break;
}
case PK_TYPE_11B:
return vnt_rxtx_rts_ab_head(tx_context, &head->rts_ab,
byPktType, cbFrameLength, bNeedAck,
- wCurrentRate, byFBOption);
+ wCurrentRate);
}

return 0;
@@ -574,7 +571,7 @@ static u16 s_vFillRTSHead(struct vnt_usb_send_context *tx_context, u8 byPktType,

static u16 s_vFillCTSHead(struct vnt_usb_send_context *tx_context,
u8 byPktType, union vnt_tx_data_head *head, u32 cbFrameLength,
- int bNeedAck, u16 wCurrentRate, u8 byFBOption)
+ int bNeedAck, u16 wCurrentRate)
{
struct vnt_private *pDevice = tx_context->priv;
u32 uCTSFrameLen = 14;
@@ -590,15 +587,15 @@ static u16 s_vFillCTSHead(struct vnt_usb_send_context *tx_context,
pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b);
pBuf->duration_ba = s_uGetRTSCTSDuration(pDevice, CTSDUR_BA,
cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, byFBOption);
+ wCurrentRate, bNeedAck);
/* Get CTSDuration_ba_f0 */
pBuf->cts_duration_ba_f0 = s_uGetRTSCTSDuration(pDevice,
CTSDUR_BA_F0, cbFrameLength, byPktType,
- pDevice->tx_rate_fb0, bNeedAck, byFBOption);
+ pDevice->tx_rate_fb0, bNeedAck);
/* Get CTSDuration_ba_f1 */
pBuf->cts_duration_ba_f1 = s_uGetRTSCTSDuration(pDevice,
CTSDUR_BA_F1, cbFrameLength, byPktType,
- pDevice->tx_rate_fb1, bNeedAck, byFBOption);
+ pDevice->tx_rate_fb1, bNeedAck);
/* Get CTS Frame body */
pBuf->data.duration = pBuf->duration_ba;
pBuf->data.frame_control =
@@ -617,7 +614,7 @@ static u16 s_vFillCTSHead(struct vnt_usb_send_context *tx_context,
/* Get CTSDuration_ba */
pBuf->duration_ba = s_uGetRTSCTSDuration(pDevice,
CTSDUR_BA, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, byFBOption);
+ wCurrentRate, bNeedAck);
/*Get CTS Frame body*/
pBuf->data.duration = pBuf->duration_ba;
pBuf->data.frame_control =
@@ -662,16 +659,8 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
struct vnt_private *pDevice = tx_context->priv;
struct vnt_tx_fifo_head *pFifoHead = &tx_buffer->fifo_head;
union vnt_tx_data_head *head = NULL;
- u16 wFifoCtl;
- u8 byFBOption = AUTO_FB_NONE;

pFifoHead->current_rate = cpu_to_le16(wCurrentRate);
- wFifoCtl = pFifoHead->wFIFOCtl;
-
- if (wFifoCtl & FIFOCTL_AUTO_FB_0)
- byFBOption = AUTO_FB_0;
- else if (wFifoCtl & FIFOCTL_AUTO_FB_1)
- byFBOption = AUTO_FB_1;

if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
if (need_rts) {
@@ -702,7 +691,7 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
/* Fill RTS */
return s_vFillRTSHead(tx_context, byPktType, head,
cbFrameSize, bNeedACK,
- wCurrentRate, byFBOption);
+ wCurrentRate);

} else {
struct vnt_rrv_time_cts *pBuf = &tx_buffer->
@@ -727,8 +716,7 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,

/* Fill CTS */
return s_vFillCTSHead(tx_context, byPktType,
- head, cbFrameSize, bNeedACK, wCurrentRate,
- byFBOption);
+ head, cbFrameSize, bNeedACK, wCurrentRate);
}
} else if (byPktType == PK_TYPE_11A) {
if (need_mic) {
@@ -751,7 +739,7 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
/* Fill RTS */
return s_vFillRTSHead(tx_context, byPktType, head,
cbFrameSize, bNeedACK,
- wCurrentRate, byFBOption);
+ wCurrentRate);
} else {
struct vnt_rrv_time_ab *pBuf = &tx_buffer->
tx_head.tx_ab.ab;
@@ -786,7 +774,7 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
/* Fill RTS */
return s_vFillRTSHead(tx_context, byPktType, head,
cbFrameSize, bNeedACK,
- wCurrentRate, byFBOption);
+ wCurrentRate);
} else {
struct vnt_rrv_time_ab *pBuf = &tx_buffer->
tx_head.tx_ab.ab;
--
1.9.1


2014-07-10 18:57:04

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 10/16] staging: vt6656: move s_vFillCTSHead to vnt_rxtx_cts

add need_mic and union vnt_tx_data_head head positions from s_vGenerateTxParameter.

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 0ff8b50..c8a38c5 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -651,10 +651,12 @@ static u16 vnt_rxtx_rts(struct vnt_usb_send_context *tx_context,

static u16 vnt_rxtx_cts(struct vnt_usb_send_context *tx_context,
union vnt_tx_head *tx_head, u8 pkt_type, u32 frame_size,
- int need_ack, u16 current_rate)
+ int need_ack, u16 current_rate, bool need_mic)
{
struct vnt_private *priv = tx_context->priv;
struct vnt_rrv_time_cts *buf = &tx_head->tx_cts.cts;
+ union vnt_tx_data_head *head = &tx_head->tx_cts.tx.head;
+

buf->rrv_time_a = vnt_rxtx_rsvtime_le16(priv, pkt_type,
frame_size, current_rate, need_ack);
@@ -664,7 +666,12 @@ static u16 vnt_rxtx_cts(struct vnt_usb_send_context *tx_context,
buf->cts_rrv_time_ba = s_uGetRTSCTSRsvTime(priv, 3,
pkt_type, frame_size, current_rate);

- return 0;
+ if (need_mic)
+ head = &tx_head->tx_cts.tx.mic.head;
+
+ /* Fill CTS */
+ return s_vFillCTSHead(tx_context, pkt_type, head, frame_size,
+ need_ack, current_rate);
}

static u16 vnt_rxtx_ab(struct vnt_usb_send_context *tx_context,
@@ -728,20 +735,13 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
byPktType, cbFrameSize, bNeedACK,
wCurrentRate, need_mic);
} else {
- vnt_rxtx_cts(tx_context, &tx_buffer->tx_head,
- byPktType, cbFrameSize, bNeedACK, wCurrentRate);
-
- if (need_mic) {
+ if (need_mic)
*mic_hdr = &tx_buffer->
tx_head.tx_cts.tx.mic.hdr;
- head = &tx_buffer->tx_head.tx_cts.tx.mic.head;
- } else {
- head = &tx_buffer->tx_head.tx_cts.tx.head;
- }
-
- /* Fill CTS */
- return s_vFillCTSHead(tx_context, byPktType,
- head, cbFrameSize, bNeedACK, wCurrentRate);
+
+ return vnt_rxtx_cts(tx_context, &tx_buffer->tx_head,
+ byPktType, cbFrameSize, bNeedACK,
+ wCurrentRate, need_mic);
}
} else if (byPktType == PK_TYPE_11A) {
if (need_mic) {
--
1.9.1


2014-07-10 18:56:50

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 04/16] staging: vt6656: move current_rate setting out of s_vGenerateTxParameter

Removing unneeded pointers

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 57e1dff..2ed045d 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -657,11 +657,8 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
int bNeedACK, bool need_rts)
{
struct vnt_private *pDevice = tx_context->priv;
- struct vnt_tx_fifo_head *pFifoHead = &tx_buffer->fifo_head;
union vnt_tx_data_head *head = NULL;

- pFifoHead->current_rate = cpu_to_le16(wCurrentRate);
-
if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
if (need_rts) {
struct vnt_rrv_time_rts *pBuf =
@@ -982,6 +979,8 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb)
frame_size += tx_key->icv_len;
}

+ tx_buffer_head->current_rate = cpu_to_le16(current_rate);
+
/* legacy rates TODO use ieee80211_tx_rate */
if (current_rate >= RATE_18M && ieee80211_is_data(hdr->frame_control)) {
if (priv->byAutoFBCtrl == AUTO_FB_0) {
--
1.9.1


2014-07-10 18:57:04

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 11/16] staging: vt6656: merge data positions for packet types a and b into vnt_rxtx_ab

add rts positions from s_vFillRTSHead

add need_mic and remaining union vnt_tx_data_head head positions from
s_vGenerateTxParameter for packet type PK_TYPE_11A and PK_TYPE_11B..

As there are no other possibilities for packet types in s_vGenerateTxParameter
the if becomes else.

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index c8a38c5..6113807 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -98,10 +98,6 @@ static u16 s_vFillCTSHead(struct vnt_usb_send_context *tx_context,
u8 byPktType, union vnt_tx_data_head *head, u32 cbFrameLength,
int bNeedAck, u16 wCurrentRate);

-static u16 s_vFillRTSHead(struct vnt_usb_send_context *tx_context, u8 byPktType,
- union vnt_tx_data_head *head, u32 cbFrameLength, int bNeedAck,
- u16 wCurrentRate);
-
static __le16 s_uGetDataDuration(struct vnt_private *pDevice,
u8 byPktType, int bNeedAck);

@@ -528,36 +524,6 @@ static u16 vnt_rxtx_rts_a_fb_head(struct vnt_usb_send_context *tx_context,
&buf->data_head, frame_len, need_ack);
}

-static u16 s_vFillRTSHead(struct vnt_usb_send_context *tx_context, u8 byPktType,
- union vnt_tx_data_head *head, u32 cbFrameLength, int bNeedAck,
- u16 wCurrentRate)
-{
-
- if (!head)
- return 0;
-
- /* Note: So far RTSHead doesn't appear in ATIM
- * & Beacom DMA, so we don't need to take them
- * into account.
- * Otherwise, we need to modified codes for them.
- */
- switch (byPktType) {
- case PK_TYPE_11A:
- if (tx_context->fb_option) {
- return vnt_rxtx_rts_a_fb_head(tx_context,
- &head->rts_a_fb, byPktType,
- cbFrameLength, bNeedAck, wCurrentRate);
- break;
- }
- case PK_TYPE_11B:
- return vnt_rxtx_rts_ab_head(tx_context, &head->rts_ab,
- byPktType, cbFrameLength, bNeedAck,
- wCurrentRate);
- }
-
- return 0;
-}
-
static u16 s_vFillCTSHead(struct vnt_usb_send_context *tx_context,
u8 byPktType, union vnt_tx_data_head *head, u32 cbFrameLength,
int bNeedAck, u16 wCurrentRate)
@@ -676,14 +642,18 @@ static u16 vnt_rxtx_cts(struct vnt_usb_send_context *tx_context,

static u16 vnt_rxtx_ab(struct vnt_usb_send_context *tx_context,
union vnt_tx_head *tx_head, u8 pkt_type, u32 frame_size,
- int need_ack, u16 current_rate, bool need_rts)
+ int need_ack, u16 current_rate, bool need_rts, bool need_mic)
{
struct vnt_private *priv = tx_context->priv;
struct vnt_rrv_time_ab *buf = &tx_head->tx_ab.ab;
+ union vnt_tx_data_head *head = &tx_head->tx_ab.tx.head;

buf->rrv_time = vnt_rxtx_rsvtime_le16(priv, pkt_type,
frame_size, current_rate, need_ack);

+ if (need_mic)
+ head = &tx_head->tx_ab.tx.mic.head;
+
if (need_rts) {
if (pkt_type == PK_TYPE_11B)
buf->rts_rrv_time = s_uGetRTSCTSRsvTime(priv, 0,
@@ -691,9 +661,23 @@ static u16 vnt_rxtx_ab(struct vnt_usb_send_context *tx_context,
else /* PK_TYPE_11A */
buf->rts_rrv_time = s_uGetRTSCTSRsvTime(priv, 2,
pkt_type, frame_size, current_rate);
+
+ if (tx_context->fb_option && pkt_type == PK_TYPE_11A)
+ return vnt_rxtx_rts_a_fb_head(tx_context,
+ &head->rts_a_fb, pkt_type, frame_size,
+ need_ack, current_rate);
+
+ return vnt_rxtx_rts_ab_head(tx_context, &head->rts_ab,
+ pkt_type, frame_size, need_ack, current_rate);
}

- return 0;
+ if (pkt_type == PK_TYPE_11A)
+ return vnt_rxtx_datahead_a_fb(tx_context, pkt_type,
+ current_rate, &head->data_head_a_fb,
+ frame_size, need_ack);
+
+ return vnt_rxtx_datahead_ab(tx_context, pkt_type, current_rate,
+ &head->data_head_ab, frame_size, need_ack);
}

/*+
@@ -723,7 +707,6 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
struct vnt_mic_hdr **mic_hdr, u32 need_mic, u32 cbFrameSize,
int bNeedACK, bool need_rts)
{
- union vnt_tx_data_head *head = NULL;

if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
if (need_rts) {
@@ -743,55 +726,13 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
byPktType, cbFrameSize, bNeedACK,
wCurrentRate, need_mic);
}
- } else if (byPktType == PK_TYPE_11A) {
- if (need_mic) {
- *mic_hdr = &tx_buffer->tx_head.tx_ab.tx.mic.hdr;
- head = &tx_buffer->tx_head.tx_ab.tx.mic.head;
- } else {
- head = &tx_buffer->tx_head.tx_ab.tx.head;
- }
-
- if (need_rts) {
- vnt_rxtx_ab(tx_context, &tx_buffer->tx_head, byPktType,
- cbFrameSize, bNeedACK, wCurrentRate, need_rts);
-
-
- /* Fill RTS */
- return s_vFillRTSHead(tx_context, byPktType, head,
- cbFrameSize, bNeedACK,
- wCurrentRate);
- } else {
- vnt_rxtx_ab(tx_context, &tx_buffer->tx_head, byPktType,
- cbFrameSize, bNeedACK, wCurrentRate, need_rts);
-
- return vnt_rxtx_datahead_a_fb(tx_context, byPktType,
- wCurrentRate, &head->data_head_a_fb,
- cbFrameSize, bNeedACK);
- }
- } else if (byPktType == PK_TYPE_11B) {
- if (need_mic) {
+ } else {
+ if (need_mic)
*mic_hdr = &tx_buffer->tx_head.tx_ab.tx.mic.hdr;
- head = &tx_buffer->tx_head.tx_ab.tx.mic.head;
- } else {
- head = &tx_buffer->tx_head.tx_ab.tx.head;
- }

- if (need_rts) {
- vnt_rxtx_ab(tx_context, &tx_buffer->tx_head, byPktType,
- cbFrameSize, bNeedACK, wCurrentRate, need_rts);
-
- /* Fill RTS */
- return s_vFillRTSHead(tx_context, byPktType, head,
- cbFrameSize, bNeedACK,
- wCurrentRate);
- } else {
- vnt_rxtx_ab(tx_context, &tx_buffer->tx_head, byPktType,
- cbFrameSize, bNeedACK, wCurrentRate, need_rts);
-
- return vnt_rxtx_datahead_ab(tx_context, byPktType,
- wCurrentRate, &head->data_head_ab,
- cbFrameSize, bNeedACK);
- }
+ return vnt_rxtx_ab(tx_context, &tx_buffer->tx_head,
+ byPktType, cbFrameSize, bNeedACK,
+ wCurrentRate, need_rts, need_mic);
}

return 0;
--
1.9.1


2014-07-10 18:56:56

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 06/16] staging: vt6656: s_vGenerateTxParameter Parse out struct vnt_rrv_time_cts

Create new function vnt_rxtx_cts that will eventually carry onward
function.

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 7d0b74c..49bda3c 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -651,6 +651,24 @@ static u16 vnt_rxtx_rts(struct vnt_usb_send_context *tx_context,
return 0;
}

+static u16 vnt_rxtx_cts(struct vnt_usb_send_context *tx_context,
+ union vnt_tx_head *tx_head, u8 pkt_type, u32 frame_size,
+ int need_ack, u16 current_rate)
+{
+ struct vnt_private *priv = tx_context->priv;
+ struct vnt_rrv_time_cts *buf = &tx_head->tx_cts.cts;
+
+ buf->rrv_time_a = vnt_rxtx_rsvtime_le16(priv, pkt_type,
+ frame_size, current_rate, need_ack);
+ buf->rrv_time_b = vnt_rxtx_rsvtime_le16(priv, PK_TYPE_11B,
+ frame_size, priv->byTopCCKBasicRate, need_ack);
+
+ buf->cts_rrv_time_ba = s_uGetRTSCTSRsvTime(priv, 3,
+ pkt_type, frame_size, current_rate);
+
+ return 0;
+}
+
/*+
*
* Description:
@@ -700,17 +718,8 @@ static u16 s_vGenerateTxParameter(struct vnt_usb_send_context *tx_context,
wCurrentRate);

} else {
- struct vnt_rrv_time_cts *pBuf = &tx_buffer->
- tx_head.tx_cts.cts;
-
- pBuf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice,
- byPktType, cbFrameSize, wCurrentRate, bNeedACK);
- pBuf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice,
- PK_TYPE_11B, cbFrameSize,
- pDevice->byTopCCKBasicRate, bNeedACK);
-
- pBuf->cts_rrv_time_ba = s_uGetRTSCTSRsvTime(pDevice, 3,
- byPktType, cbFrameSize, wCurrentRate);
+ vnt_rxtx_cts(tx_context, &tx_buffer->tx_head,
+ byPktType, cbFrameSize, bNeedACK, wCurrentRate);

if (need_mic) {
*mic_hdr = &tx_buffer->
--
1.9.1