2014-04-30 20:32:53

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 1/4] staging: vt6656: rxtx: Remove unused uDMAIdx from driver.

Remove from functions and callers.

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

diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 3c93230..0b0bc77 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -1189,7 +1189,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev)
goto out;
}

- if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb)) {
+ if (nsDMA_tx_packet(pDevice, skb)) {
if (netif_queue_stopped(dev))
netif_wake_queue(dev);
}
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 1ff1446..4977f72 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -101,11 +101,11 @@ static struct vnt_usb_send_context *s_vGetFreeContext(struct vnt_private *);
static u16 s_vGenerateTxParameter(struct vnt_private *pDevice,
u8 byPktType, u16 wCurrentRate, struct vnt_tx_buffer *tx_buffer,
struct vnt_mic_hdr **mic_hdr, u32 need_mic, u32 cbFrameSize,
- int bNeedACK, u32 uDMAIdx, struct ethhdr *psEthHeader, bool need_rts);
+ int bNeedACK, struct ethhdr *psEthHeader, bool need_rts);

static void s_vGenerateMACHeader(struct vnt_private *pDevice,
u8 *pbyBufferAddr, u16 wDuration, struct ethhdr *psEthHeader,
- int bNeedEncrypt, u16 wFragType, u32 uDMAIdx, u32 uFragIdx);
+ int bNeedEncrypt, u16 wFragType, u32 uFragIdx);

static void s_vFillTxKey(struct vnt_private *pDevice,
struct vnt_tx_fifo_head *fifo_head, u8 *pbyIVHead,
@@ -121,7 +121,7 @@ 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_lenght, u16 current_rate);

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

@@ -714,7 +714,7 @@ static u16 s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
return 0;
}

-static u16 s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
+static u16 s_vFillCTSHead(struct vnt_private *pDevice,
u8 byPktType, union vnt_tx_data_head *head, u32 cbFrameLength,
int bNeedAck, u16 wCurrentRate, u8 byFBOption)
{
@@ -787,7 +787,6 @@ static u16 s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
* pCTS - CTS Buffer
* cbFrameSize - Transmit Data Length (Hdr+Payload+FCS)
* bNeedACK - If need ACK
- * uDMAIdx - DMA Index
* Out:
* none
*
@@ -798,7 +797,7 @@ static u16 s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
static u16 s_vGenerateTxParameter(struct vnt_private *pDevice,
u8 byPktType, u16 wCurrentRate, struct vnt_tx_buffer *tx_buffer,
struct vnt_mic_hdr **mic_hdr, u32 need_mic, u32 cbFrameSize,
- int bNeedACK, u32 uDMAIdx, struct ethhdr *psEthHeader, bool need_rts)
+ int bNeedACK, struct ethhdr *psEthHeader, bool need_rts)
{
struct vnt_tx_fifo_head *pFifoHead = &tx_buffer->fifo_head;
union vnt_tx_data_head *head = NULL;
@@ -869,7 +868,7 @@ static u16 s_vGenerateTxParameter(struct vnt_private *pDevice,
}

/* Fill CTS */
- return s_vFillCTSHead(pDevice, uDMAIdx, byPktType,
+ return s_vFillCTSHead(pDevice, byPktType,
head, cbFrameSize, bNeedACK, wCurrentRate,
byFBOption);
}
@@ -954,7 +953,7 @@ static u16 s_vGenerateTxParameter(struct vnt_private *pDevice,

static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType,
struct vnt_tx_buffer *tx_buffer, int bNeedEncryption,
- u32 uSkbPacketLen, u32 uDMAIdx, struct ethhdr *psEthHeader,
+ u32 uSkbPacketLen, struct ethhdr *psEthHeader,
u8 *pPacket, PSKeyItem pTransmitKey, u32 uNodeIndex, u16 wCurrentRate,
u32 *pcbHeaderLen, u32 *pcbTotalLen)
{
@@ -1150,17 +1149,16 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType,
//=========================
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"No Fragmentation...\n");
byFragType = FRAGCTL_NONFRAG;
- //uDMAIdx = TYPE_AC0DMA;
//pTxBufHead = (PSTxBufHead) &(pTxBufHead->adwTxKey[0]);

/* Fill FIFO, RrvTime, RTS and CTS */
uDuration = s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate,
tx_buffer, &pMICHDR, cbMICHDR,
- cbFrameSize, bNeedACK, uDMAIdx, psEthHeader, bRTS);
+ cbFrameSize, bNeedACK, psEthHeader, bRTS);

// Generate TX MAC Header
s_vGenerateMACHeader(pDevice, pbyMacHdr, (u16)uDuration, psEthHeader, bNeedEncryption,
- byFragType, uDMAIdx, 0);
+ byFragType, 0);

if (bNeedEncryption == true) {
//Fill TXKEY
@@ -1292,7 +1290,7 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType,

static void s_vGenerateMACHeader(struct vnt_private *pDevice,
u8 *pbyBufferAddr, u16 wDuration, struct ethhdr *psEthHeader,
- int bNeedEncrypt, u16 wFragType, u32 uDMAIdx, u32 uFragIdx)
+ int bNeedEncrypt, u16 wFragType, u32 uFragIdx)
{
struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyBufferAddr;

@@ -1532,7 +1530,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
/* Fill FIFO,RrvTime,RTS,and CTS */
uDuration = s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate,
pTX_Buffer, &pMICHDR, 0,
- cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, false);
+ cbFrameSize, bNeedACK, &sEthHeader, false);

pMACHeader = (struct ieee80211_hdr *) (pbyTxBufferAddr + cbHeaderSize);

@@ -1926,7 +1924,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
/* Fill FIFO,RrvTime,RTS,and CTS */
uDuration = s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate,
pTX_Buffer, &pMICHDR, cbMICHDR,
- cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, false);
+ cbFrameSize, bNeedACK, &sEthHeader, false);

pMACHeader = (struct ieee80211_hdr *) (pbyTxBufferAddr + cbHeaderSize);

@@ -2088,8 +2086,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
* Return Value: NULL
*/

-int nsDMA_tx_packet(struct vnt_private *pDevice,
- u32 uDMAIdx, struct sk_buff *skb)
+int nsDMA_tx_packet(struct vnt_private *pDevice, struct sk_buff *skb)
{
struct net_device_stats *pStats = &pDevice->stats;
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
@@ -2420,7 +2417,7 @@ int nsDMA_tx_packet(struct vnt_private *pDevice,

fConvertedPacket = s_bPacketToWirelessUsb(pDevice, byPktType,
pTX_Buffer, bNeedEncryption,
- skb->len, uDMAIdx, &pDevice->sTxEthHeader,
+ skb->len, &pDevice->sTxEthHeader,
(u8 *)skb->data, pTransmitKey, uNodeIndex,
pDevice->wCurrentRate,
&uHeaderLen, &BytesToWrite
@@ -2584,7 +2581,7 @@ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen,

fConvertedPacket = s_bPacketToWirelessUsb(pDevice, byPktType,
pTX_Buffer, bNeedEncryption,
- uDataLen, TYPE_AC0DMA, &pDevice->sTxEthHeader,
+ uDataLen, &pDevice->sTxEthHeader,
pbySkbData, pTransmitKey, uNodeIndex,
pDevice->wCurrentRate,
&uHeaderLen, &BytesToWrite
diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h
index 4dfb2e0..982f162 100644
--- a/drivers/staging/vt6656/rxtx.h
+++ b/drivers/staging/vt6656/rxtx.h
@@ -247,7 +247,7 @@ struct vnt_beacon_buffer {
} __packed;

void vDMA0_tx_80211(struct vnt_private *, struct sk_buff *skb);
-int nsDMA_tx_packet(struct vnt_private *, u32 uDMAIdx, struct sk_buff *skb);
+int nsDMA_tx_packet(struct vnt_private *, struct sk_buff *skb);
CMD_STATUS csMgmt_xmit(struct vnt_private *, struct vnt_tx_mgmt *);
CMD_STATUS csBeacon_xmit(struct vnt_private *, struct vnt_tx_mgmt *);
int bRelayPacketSend(struct vnt_private *, u8 *pbySkbData, u32 uDataLen,
diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c
index 3cf3f24..de7e808 100644
--- a/drivers/staging/vt6656/wcmd.c
+++ b/drivers/staging/vt6656/wcmd.c
@@ -675,7 +675,7 @@ void vRunCommand(struct work_struct *work)
pDevice->bMoreData = true;
}

- if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0)
+ if (nsDMA_tx_packet(pDevice, skb) != 0)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail\n");

pMgmt->sNodeDBTable[0].wEnQueueCnt--;
@@ -698,7 +698,7 @@ void vRunCommand(struct work_struct *work)
pDevice->bMoreData = true;
}

- if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0)
+ if (nsDMA_tx_packet(pDevice, skb) != 0)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail\n");

pMgmt->sNodeDBTable[ii].wEnQueueCnt--;
--
1.9.1



2014-04-30 20:33:05

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 3/4] staging: vt6656: nsDMA_tx_packet Move pContext later

call s_vGetFreeContext later in function skiping large
chunk of code.

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 4977f72..6bef0e3 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -2175,14 +2175,6 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, struct sk_buff *skb)
}
}

- pContext = s_vGetFreeContext(pDevice);
-
- if (pContext == NULL) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG" pContext == NULL\n");
- dev_kfree_skb_irq(skb);
- return STATUS_RESOURCES;
- }
-
memcpy(pDevice->sTxEthHeader.h_dest, (u8 *)(skb->data), ETH_HLEN);

//mike add:station mode check eapol-key challenge--->
@@ -2405,7 +2397,6 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, struct sk_buff *skb)

if (pTransmitKey == NULL) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"return no tx key\n");
- pContext->bBoolInUse = false;
dev_kfree_skb_irq(skb);
pStats->tx_dropped++;
return STATUS_FAILURE;
@@ -2413,6 +2404,13 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, struct sk_buff *skb)
}
}

+ pContext = s_vGetFreeContext(pDevice);
+ if (!pContext) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG" pContext == NULL\n");
+ dev_kfree_skb_irq(skb);
+ return STATUS_RESOURCES;
+ }
+
pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0];

fConvertedPacket = s_bPacketToWirelessUsb(pDevice, byPktType,
--
1.9.1


2014-04-30 20:33:03

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 2/4] staging: vt6656: desh.h Remove unused macros and structures.

All are dead and of no use.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/desc.h | 55 -------------------------------------------
1 file changed, 55 deletions(-)

diff --git a/drivers/staging/vt6656/desc.h b/drivers/staging/vt6656/desc.h
index 7c6dd5f..171315a 100644
--- a/drivers/staging/vt6656/desc.h
+++ b/drivers/staging/vt6656/desc.h
@@ -91,15 +91,6 @@
#define TSR_ACKDATA 0x02
#define TSR_VALID 0x01

-#define CB_PROTOCOL_RESERVED_SECTION 16
-
-/*
- * if retries exceed 15 times, TX will abort, and
- * if TX fifo underflow, TX will fail
- * we should try to resend it
- */
-#define CB_MAX_TX_ABORT_RETRY 3
-
#define FIFOCTL_AUTO_FB_1 0x1000
#define FIFOCTL_AUTO_FB_0 0x0800
#define FIFOCTL_GRPACK 0x0400
@@ -126,50 +117,4 @@
#define FRAGCTL_STAFRAG 0x0001
#define FRAGCTL_NONFRAG 0x0000

-#define TYPE_TXDMA0 0
-#define TYPE_AC0DMA 1
-#define TYPE_ATIMDMA 2
-#define TYPE_SYNCDMA 3
-#define TYPE_MAXTD 2
-
-#define TYPE_BEACONDMA 4
-
-#define TYPE_RXDMA0 0
-#define TYPE_RXDMA1 1
-#define TYPE_MAXRD 2
-
-/* TD_INFO flags control bit */
-#define TD_FLAGS_NETIF_SKB 0x01 /* check if need release skb */
-#define TD_FLAGS_PRIV_SKB 0x02 /* check if called from private skb(hostap) */
-#define TD_FLAGS_PS_RETRY 0x04 /* check if PS STA frame re-transmit */
-
-/*
- * TX FIFO header
- */
-typedef struct tagSBEACONCtl {
- u32 BufReady:1;
- u32 TSF:15;
- u32 BufLen:11;
- u32 Reserved:5;
-} __attribute__ ((__packed__))
-SBEACONCtl;
-
-typedef struct tagSSecretKey {
- u32 dwLowDword;
- u8 byHighByte;
-} __attribute__ ((__packed__))
-SSecretKey;
-
-typedef struct tagSKeyEntry {
- u8 abyAddrHi[2];
- u16 wKCTL;
- u8 abyAddrLo[4];
- u32 dwKey0[4];
- u32 dwKey1[4];
- u32 dwKey2[4];
- u32 dwKey3[4];
- u32 dwKey4[4];
-} __attribute__ ((__packed__))
-SKeyEntry;
-
#endif /* __DESC_H__ */
--
1.9.1


2014-04-30 20:33:07

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 4/4] staging: vt6656: struct vnt_usb_send_context remove camel case.

Camel case changes
pDevice -> priv
pPacket -> skb
pUrb -> urb
uBufLen -> buf_len;
bBoolInUse -> in_use
Data -> data

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/device.h | 12 +++----
drivers/staging/vt6656/main_usb.c | 14 ++++----
drivers/staging/vt6656/rxtx.c | 74 +++++++++++++++++++--------------------
drivers/staging/vt6656/usbpipe.c | 26 +++++++-------
4 files changed, 63 insertions(+), 63 deletions(-)

diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index e2abe3d..f36a2eb 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -176,13 +176,13 @@ struct vnt_rcb {

/* used to track bulk out irps */
struct vnt_usb_send_context {
- void *pDevice;
- struct sk_buff *pPacket;
- struct urb *pUrb;
- unsigned int uBufLen;
+ void *priv;
+ struct sk_buff *skb;
+ struct urb *urb;
+ unsigned int buf_len;
u8 type;
- bool bBoolInUse;
- unsigned char Data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS];
+ bool in_use;
+ unsigned char data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS];
};

/* tx packet info for rxtx */
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 0b0bc77..374d7de 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -757,9 +757,9 @@ static void device_free_tx_bufs(struct vnt_private *priv)
for (ii = 0; ii < priv->cbTD; ii++) {
tx_context = priv->apTD[ii];
/* deallocate URBs */
- if (tx_context->pUrb) {
- usb_kill_urb(tx_context->pUrb);
- usb_free_urb(tx_context->pUrb);
+ if (tx_context->urb) {
+ usb_kill_urb(tx_context->urb);
+ usb_free_urb(tx_context->urb);
}

kfree(tx_context);
@@ -825,17 +825,17 @@ static bool device_alloc_bufs(struct vnt_private *priv)
}

priv->apTD[ii] = tx_context;
- tx_context->pDevice = priv;
+ tx_context->priv = priv;

/* allocate URBs */
- tx_context->pUrb = usb_alloc_urb(0, GFP_ATOMIC);
- if (tx_context->pUrb == NULL) {
+ tx_context->urb = usb_alloc_urb(0, GFP_ATOMIC);
+ if (!tx_context->urb) {
DBG_PRT(MSG_LEVEL_ERR,
KERN_ERR "alloc tx urb failed\n");
goto free_tx;
}

- tx_context->bBoolInUse = false;
+ tx_context->in_use = false;
}

/* allocate RCB mem */
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 6bef0e3..0280ed2 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -149,9 +149,9 @@ static struct vnt_usb_send_context
return NULL;

context = priv->apTD[ii];
- if (context->bBoolInUse == false) {
- context->bBoolInUse = true;
- memset(context->Data, 0,
+ if (context->in_use == false) {
+ context->in_use = true;
+ memset(context->data, 0,
MAX_TOTAL_SIZE_WITH_ALL_HEADERS);
return context;
}
@@ -1394,7 +1394,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
return CMD_STATUS_RESOURCES;
}

- pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0];
+ pTX_Buffer = (struct vnt_tx_buffer *)&pContext->data[0];
cbFrameBodySize = pPacket->cbPayloadLen;
pTxBufHead = &pTX_Buffer->fifo_head;
pbyTxBufferAddr = (u8 *)&pTxBufHead->adwTxKey[0];
@@ -1612,9 +1612,9 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
pTX_Buffer->byPKTNO = (u8) (((wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F));
pTX_Buffer->byType = 0x00;

- pContext->pPacket = NULL;
- pContext->type = CONTEXT_MGMT_PACKET;
- pContext->uBufLen = (u16)cbReqCount + 4; //USB header
+ pContext->skb = NULL;
+ pContext->type = CONTEXT_MGMT_PACKET;
+ pContext->buf_len = (u16)cbReqCount + 4; /* USB header */

if (WLAN_GET_FC_TODS(pMACHeader->frame_control) == 0) {
s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F),
@@ -1652,7 +1652,7 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice,
return status ;
}

- pTX_Buffer = (struct vnt_beacon_buffer *)&pContext->Data[0];
+ pTX_Buffer = (struct vnt_beacon_buffer *)&pContext->data[0];
short_head = &pTX_Buffer->short_head;

cbFrameBodySize = pPacket->cbPayloadLen;
@@ -1704,9 +1704,9 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice,
pTX_Buffer->byPKTNO = (u8) (((wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F));
pTX_Buffer->byType = 0x01;

- pContext->pPacket = NULL;
- pContext->type = CONTEXT_MGMT_PACKET;
- pContext->uBufLen = (u16)cbReqCount + 4; //USB header
+ pContext->skb = NULL;
+ pContext->type = CONTEXT_MGMT_PACKET;
+ pContext->buf_len = (u16)cbReqCount + 4; /* USB header */

PIPEnsSendBulkOut(pDevice,pContext);
return CMD_STATUS_PENDING;
@@ -1763,7 +1763,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
return ;
}

- pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0];
+ pTX_Buffer = (struct vnt_tx_buffer *)&pContext->data[0];
pTxBufHead = &pTX_Buffer->fifo_head;
pbyTxBufferAddr = (u8 *)&pTxBufHead->adwTxKey[0];
wTxBufSize = sizeof(struct vnt_tx_fifo_head);
@@ -2052,9 +2052,9 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
pTX_Buffer->byPKTNO = (u8) (((wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F));
pTX_Buffer->byType = 0x00;

- pContext->pPacket = skb;
- pContext->type = CONTEXT_MGMT_PACKET;
- pContext->uBufLen = (u16)cbReqCount + 4; //USB header
+ pContext->skb = skb;
+ pContext->type = CONTEXT_MGMT_PACKET;
+ pContext->buf_len = (u16)cbReqCount + 4; /* USB header */

if (WLAN_GET_FC_TODS(pMACHeader->frame_control) == 0) {
s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F),
@@ -2411,7 +2411,7 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, struct sk_buff *skb)
return STATUS_RESOURCES;
}

- pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0];
+ pTX_Buffer = (struct vnt_tx_buffer *)&pContext->data[0];

fConvertedPacket = s_bPacketToWirelessUsb(pDevice, byPktType,
pTX_Buffer, bNeedEncryption,
@@ -2421,11 +2421,11 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, struct sk_buff *skb)
&uHeaderLen, &BytesToWrite
);

- if (fConvertedPacket == false) {
- pContext->bBoolInUse = false;
- dev_kfree_skb_irq(skb);
- return STATUS_FAILURE;
- }
+ if (fConvertedPacket == false) {
+ pContext->in_use = false;
+ dev_kfree_skb_irq(skb);
+ return STATUS_FAILURE;
+ }

if ( pDevice->bEnablePSMode == true ) {
if ( !pDevice->bPSModeTxBurst ) {
@@ -2439,9 +2439,9 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, struct sk_buff *skb)
pTX_Buffer->byPKTNO = (u8) (((pDevice->wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F));
pTX_Buffer->tx_byte_count = cpu_to_le16((u16)BytesToWrite);

- pContext->pPacket = skb;
- pContext->type = CONTEXT_DATA_PACKET;
- pContext->uBufLen = (u16)BytesToWrite + 4 ; //USB header
+ pContext->skb = skb;
+ pContext->type = CONTEXT_DATA_PACKET;
+ pContext->buf_len = (u16)BytesToWrite + 4 ; /* USB header */

s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F),
&pDevice->sTxEthHeader.h_dest[0],
@@ -2456,14 +2456,14 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, struct sk_buff *skb)
bScheduleCommand((void *) pDevice, WLAN_CMD_DEAUTH, (u8 *) &wReason);
}

- if(status!=STATUS_PENDING) {
- pContext->bBoolInUse = false;
- dev_kfree_skb_irq(skb);
- return STATUS_FAILURE;
- }
- else
- return 0;
+ if (status != STATUS_PENDING) {
+ pContext->in_use = false;
+ dev_kfree_skb_irq(skb);
+ return STATUS_FAILURE;
+ }

+
+ return 0;
}

/*
@@ -2534,7 +2534,7 @@ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen,
}

if ( bNeedEncryption && (pTransmitKey == NULL) ) {
- pContext->bBoolInUse = false;
+ pContext->in_use = false;
return false;
}

@@ -2575,7 +2575,7 @@ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen,
// Convert the packet to an usb frame and copy into our buffer
// and send the irp.

- pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0];
+ pTX_Buffer = (struct vnt_tx_buffer *)&pContext->data[0];

fConvertedPacket = s_bPacketToWirelessUsb(pDevice, byPktType,
pTX_Buffer, bNeedEncryption,
@@ -2586,16 +2586,16 @@ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen,
);

if (fConvertedPacket == false) {
- pContext->bBoolInUse = false;
+ pContext->in_use = false;
return false;
}

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

- pContext->pPacket = NULL;
- pContext->type = CONTEXT_DATA_PACKET;
- pContext->uBufLen = (u16)BytesToWrite + 4 ; //USB header
+ pContext->skb = NULL;
+ pContext->type = CONTEXT_DATA_PACKET;
+ pContext->buf_len = (u16)BytesToWrite + 4; /* USB header */

s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F),
&pDevice->sTxEthHeader.h_dest[0],
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index c5838d9..1a6f911 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -530,17 +530,17 @@ int PIPEnsSendBulkOut(struct vnt_private *priv,
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_nsSendBulkOut\n");

if (!(MP_IS_READY(priv) && priv->Flags & fMP_POST_WRITES)) {
- context->bBoolInUse = false;
+ context->in_use = false;
return STATUS_RESOURCES;
}

- urb = context->pUrb;
+ urb = context->urb;

usb_fill_bulk_urb(urb,
priv->usb,
usb_sndbulkpipe(priv->usb, 3),
- context->Data,
- context->uBufLen,
+ context->data,
+ context->buf_len,
s_nsBulkOutIoCompleteWrite,
context);

@@ -548,7 +548,7 @@ int PIPEnsSendBulkOut(struct vnt_private *priv,
if (status != 0) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
"Submit Tx URB failed %d\n", status);
- context->bBoolInUse = false;
+ context->in_use = false;
return STATUS_FAILURE;
}

@@ -586,7 +586,7 @@ int PIPEnsSendBulkOut(struct vnt_private *priv,
static void s_nsBulkOutIoCompleteWrite(struct urb *urb)
{
struct vnt_usb_send_context *context = urb->context;
- struct vnt_private *priv = context->pDevice;
+ struct vnt_private *priv = context->priv;
u8 context_type = context->type;

DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkOutIoCompleteWrite\n");
@@ -594,12 +594,12 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb)
switch (urb->status) {
case 0:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
- "Write %d bytes\n", context->uBufLen);
+ "Write %d bytes\n", context->buf_len);
break;
case -ECONNRESET:
case -ENOENT:
case -ESHUTDOWN:
- context->bBoolInUse = false;
+ context->in_use = false;
return;
case -ETIMEDOUT:
default:
@@ -612,11 +612,11 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb)
return;

if (CONTEXT_DATA_PACKET == context_type) {
- if (context->pPacket != NULL) {
- dev_kfree_skb_irq(context->pPacket);
- context->pPacket = NULL;
+ if (context->skb != NULL) {
+ dev_kfree_skb_irq(context->skb);
+ context->skb = NULL;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
- "tx %d bytes\n", context->uBufLen);
+ "tx %d bytes\n", context->buf_len);
}

priv->dev->trans_start = jiffies;
@@ -627,7 +627,7 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb)
netif_wake_queue(priv->dev);
}

- context->bBoolInUse = false;
+ context->in_use = false;

return;
}
--
1.9.1


2014-05-15 20:26:04

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 3/4] staging: vt6656: nsDMA_tx_packet Move pContext later

On Wed, Apr 30, 2014 at 09:31:14PM +0100, Malcolm Priestley wrote:
> call s_vGetFreeContext later in function skiping large
> chunk of code.
>
> Signed-off-by: Malcolm Priestley <[email protected]>
> ---
> drivers/staging/vt6656/rxtx.c | 16 +++++++---------
> 1 file changed, 7 insertions(+), 9 deletions(-)

Due to other changes in the tree, this patch doesn't apply :(