Replace with ccmp_pn with size of IEEE80211_CCMP_PN_LEN(6)
memcpy the struct ieee80211_key_seq -> ccmp.pn onto ccmp_pn
removing the need for endian conversion.
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/rxtx.c | 8 +-------
drivers/staging/vt6656/rxtx.h | 3 +--
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 7c9f232..f4833ff 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -848,13 +848,7 @@ static void vnt_fill_txkey(struct vnt_usb_send_context *tx_context,
ieee80211_get_key_tx_seq(tx_key, &seq);
- mic_hdr->tsc_47_16 = cpu_to_be32((u32)seq.ccmp.pn[3] |
- ((u32)seq.ccmp.pn[2] << 8) |
- ((u32)seq.ccmp.pn[1] << 16) |
- ((u32)seq.ccmp.pn[0] << 24));
-
- mic_hdr->tsc_15_0 = cpu_to_be16((u16)seq.ccmp.pn[5] |
- ((u16)seq.ccmp.pn[4] << 8));
+ memcpy(mic_hdr->ccmp_pn, seq.ccmp.pn, IEEE80211_CCMP_PN_LEN);
if (ieee80211_has_a4(hdr->frame_control))
mic_hdr->hlen = cpu_to_be16(28);
diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h
index 847c055..26dc21c 100644
--- a/drivers/staging/vt6656/rxtx.h
+++ b/drivers/staging/vt6656/rxtx.h
@@ -41,8 +41,7 @@ struct vnt_mic_hdr {
u8 id;
u8 tx_priority;
u8 mic_addr2[6];
- __be32 tsc_47_16;
- __be16 tsc_15_0;
+ u8 ccmp_pn[IEEE80211_CCMP_PN_LEN];
__be16 payload_len;
__be16 hlen;
__le16 frame_control;
--
1.9.1
Move to vnt_add_interface and allow to refresh at the start
of every software scan in vnt_sw_scan_start
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/main_usb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index e0ed1bb..14845ec 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -438,7 +438,6 @@ static int device_init_registers(struct vnt_private *pDevice)
pDevice->bShortSlotTime = false;
BBvSetShortSlotTime(pDevice);
- vnt_set_bss_mode(pDevice);
pDevice->byRadioCtl = pDevice->abyEEPROM[EEP_OFS_RADIOCTL];
pDevice->bHWRadioOff = false;
@@ -749,6 +748,8 @@ static int vnt_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
priv->op_mode = vif->type;
+ vnt_set_bss_mode(priv);
+
/* LED blink on TX */
vnt_mac_set_led(priv, LEDSTS_STS, LEDSTS_INTER);
@@ -992,6 +993,7 @@ static void vnt_sw_scan_start(struct ieee80211_hw *hw)
{
struct vnt_private *priv = hw->priv;
+ vnt_set_bss_mode(priv);
/* Set max sensitivity*/
BBvUpdatePreEDThreshold(priv, true);
}
--
1.9.1
Remove work_struct and queue variables
Remove EnqueueRCB and DequeueRCB macros
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/device.h | 29 -----------------
drivers/staging/vt6656/dpc.c | 68 ---------------------------------------
drivers/staging/vt6656/main_usb.c | 1 -
3 files changed, 98 deletions(-)
diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index 0bba96f..f1ed43e 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -289,8 +289,6 @@ struct vnt_private {
struct usb_device *usb;
struct net_device_stats stats;
- struct work_struct read_work_item;
-
u64 tsf_time;
u8 rx_rate;
@@ -308,14 +306,8 @@ struct vnt_private {
u32 int_interval;
/* Variables to track resources for the BULK In Pipe */
- struct vnt_rcb *pRCBMem;
struct vnt_rcb *apRCB[CB_MAX_RX_DESC];
u32 cbRD;
- struct vnt_rcb *FirstRecvFreeList;
- struct vnt_rcb *LastRecvFreeList;
- u32 NumRecvFreeList;
-
- int bIsRxWorkItemQueued;
/* Variables to track resources for the BULK Out Pipe */
struct vnt_usb_send_context *apTD[CB_MAX_TX_DESC];
@@ -448,27 +440,6 @@ struct vnt_private {
struct iw_statistics wstats; /* wireless stats */
};
-#define EnqueueRCB(_Head, _Tail, _RCB) \
-{ \
- if (!_Head) { \
- _Head = _RCB; \
- } \
- else { \
- _Tail->Next = _RCB; \
- } \
- _RCB->Next = NULL; \
- _Tail = _RCB; \
-}
-
-#define DequeueRCB(Head, Tail) \
-{ \
- struct vnt_rcb *RCB = Head; \
- if (!RCB->Next) { \
- Tail = NULL; \
- } \
- Head = RCB->Next; \
-}
-
#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \
if ((uVar) >= ((uModulo) - 1)) \
(uVar) = 0; \
diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
index 5ac5bcd..ca55554 100644
--- a/drivers/staging/vt6656/dpc.c
+++ b/drivers/staging/vt6656/dpc.c
@@ -44,74 +44,6 @@
#include "rf.h"
#include "usbpipe.h"
-//static int msglevel =MSG_LEVEL_DEBUG;
-static int msglevel =MSG_LEVEL_INFO;
-
-void RXvWorkItem(struct work_struct *work)
-{
- struct vnt_private *priv =
- container_of(work, struct vnt_private, read_work_item);
- int status;
- struct vnt_rcb *rcb = NULL;
- unsigned long flags;
-
- if (priv->Flags & fMP_DISCONNECTED)
- return;
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Rx Polling Thread\n");
-
- spin_lock_irqsave(&priv->lock, flags);
-
- while ((priv->Flags & fMP_POST_READS) && MP_IS_READY(priv) &&
- (priv->NumRecvFreeList != 0)) {
- rcb = priv->FirstRecvFreeList;
-
- priv->NumRecvFreeList--;
-
- DequeueRCB(priv->FirstRecvFreeList, priv->LastRecvFreeList);
-
- status = PIPEnsBulkInUsbRead(priv, rcb);
- }
-
- priv->bIsRxWorkItemQueued = false;
-
- spin_unlock_irqrestore(&priv->lock, flags);
-}
-
-void RXvFreeRCB(struct vnt_rcb *rcb, int re_alloc_skb)
-{
- struct vnt_private *priv = rcb->pDevice;
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->RXvFreeRCB\n");
-
- if (re_alloc_skb == false) {
- kfree_skb(rcb->skb);
- re_alloc_skb = true;
- }
-
- if (re_alloc_skb == true) {
- rcb->skb = dev_alloc_skb(priv->rx_buf_sz);
- /* TODO error handling */
- if (!rcb->skb) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR
- " Failed to re-alloc rx skb\n");
- }
- }
-
- /* Insert the RCB back in the Recv free list */
- EnqueueRCB(priv->FirstRecvFreeList, priv->LastRecvFreeList, rcb);
- priv->NumRecvFreeList++;
-
- if ((priv->Flags & fMP_POST_READS) && MP_IS_READY(priv) &&
- (priv->bIsRxWorkItemQueued == false)) {
- priv->bIsRxWorkItemQueued = true;
- schedule_work(&priv->read_work_item);
- }
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"<----RXFreeRCB %d\n",
- priv->NumRecvFreeList);
-}
-
int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
unsigned long bytes_received)
{
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 19d42ce..a1d0c98 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -1104,7 +1104,6 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id)
mutex_init(&priv->usb_lock);
INIT_DELAYED_WORK(&priv->run_command_work, vRunCommand);
- INIT_WORK(&priv->read_work_item, RXvWorkItem);
usb_set_intfdata(intf, priv);
--
1.9.1
The driver never sets basic rate any more so remove function.
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/card.c | 22 ----------------------
drivers/staging/vt6656/card.h | 1 -
drivers/staging/vt6656/main_usb.c | 7 ++-----
3 files changed, 2 insertions(+), 28 deletions(-)
diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index 2ef45ca..82d6b64 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -470,28 +470,6 @@ void vnt_update_top_rates(struct vnt_private *priv)
priv->byTopCCKBasicRate = top_cck;
}
-/*
- * Description: Set NIC Tx Basic Rate
- *
- * Parameters:
- * In:
- * pDevice - The adapter to be set
- * wBasicRate - Basic Rate to be set
- * Out:
- * none
- *
- * Return Value: true if succeeded; false if failed.
- *
- */
-void vnt_add_basic_rate(struct vnt_private *priv, u16 rate_idx)
-{
-
- priv->wBasicRate |= (1 << rate_idx);
-
- /*Determines the highest basic rate.*/
- vnt_update_top_rates(priv);
-}
-
int vnt_ofdm_min_rate(struct vnt_private *priv)
{
int ii;
diff --git a/drivers/staging/vt6656/card.h b/drivers/staging/vt6656/card.h
index 8c6f67d..5b7cc5a 100644
--- a/drivers/staging/vt6656/card.h
+++ b/drivers/staging/vt6656/card.h
@@ -49,7 +49,6 @@ void vnt_set_channel(struct vnt_private *, u32);
void vnt_set_rspinf(struct vnt_private *, u8);
void vnt_update_ifs(struct vnt_private *);
void vnt_update_top_rates(struct vnt_private *);
-void vnt_add_basic_rate(struct vnt_private *, u16);
int vnt_ofdm_min_rate(struct vnt_private *);
void vnt_adjust_tsf(struct vnt_private *, u8, u64, u64);
bool vnt_get_current_tsf(struct vnt_private *, u64 *);
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index a1d0c98..d8164ec 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -432,13 +432,10 @@ static int device_init_registers(struct vnt_private *pDevice)
* set BB and packet type at the same time
* set Short Slot Time, xIFS, and RSPINF
*/
- if (pDevice->byBBType == BB_TYPE_11A) {
- vnt_add_basic_rate(pDevice, RATE_6M);
+ if (pDevice->byBBType == BB_TYPE_11A)
pDevice->bShortSlotTime = true;
- } else {
- vnt_add_basic_rate(pDevice, RATE_1M);
+ else
pDevice->bShortSlotTime = false;
- }
BBvSetShortSlotTime(pDevice);
vnt_set_bss_mode(pDevice);
--
1.9.1
vnt_set_bss_mode changes the state of abyBBVGA so move
BBvSetVGAGainOffset to the function.
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/card.c | 2 ++
drivers/staging/vt6656/main_usb.c | 5 -----
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index 82d6b64..1849e34 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -825,4 +825,6 @@ void vnt_set_bss_mode(struct vnt_private *priv)
priv->abyBBVGA[2] = 0x0;
priv->abyBBVGA[3] = 0x0;
}
+
+ BBvSetVGAGainOffset(priv, priv->abyBBVGA[0]);
}
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index d8164ec..e0ed1bb 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -440,11 +440,6 @@ static int device_init_registers(struct vnt_private *pDevice)
BBvSetShortSlotTime(pDevice);
vnt_set_bss_mode(pDevice);
- pDevice->byBBVGACurrent = pDevice->abyBBVGA[0];
- pDevice->byBBVGANew = pDevice->byBBVGACurrent;
-
- BBvSetVGAGainOffset(pDevice, pDevice->abyBBVGA[0]);
-
pDevice->byRadioCtl = pDevice->abyEEPROM[EEP_OFS_RADIOCTL];
pDevice->bHWRadioOff = false;
--
1.9.1
In s_nsBulkInUsbIoCompleteRead reuse or reallocate sb_buff and resubmit
urb.
In device_alloc_bufs allocate memory to rcb individually and
call PIPEnsBulkInUsbRead to submit the urbs
Change handling to free rcb in device_free_rx_bufs
Remove calls to workqueue.
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/main_usb.c | 38 +++++++++++++++-----------------------
drivers/staging/vt6656/usbpipe.c | 25 +++++++++++++++----------
2 files changed, 30 insertions(+), 33 deletions(-)
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 86d9470..19d42ce 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -514,6 +514,8 @@ static void device_free_rx_bufs(struct vnt_private *priv)
for (ii = 0; ii < priv->cbRD; ii++) {
rcb = priv->apRCB[ii];
+ if (!rcb)
+ continue;
/* deallocate URBs */
if (rcb->pUrb) {
@@ -524,9 +526,9 @@ static void device_free_rx_bufs(struct vnt_private *priv)
/* deallocate skb */
if (rcb->skb)
dev_kfree_skb(rcb->skb);
- }
- kfree(priv->pRCBMem);
+ kfree(rcb);
+ }
return;
}
@@ -576,22 +578,16 @@ static bool device_alloc_bufs(struct vnt_private *priv)
tx_context->in_use = false;
}
- /* allocate RCB mem */
- priv->pRCBMem = kzalloc((sizeof(struct vnt_rcb) * priv->cbRD),
- GFP_KERNEL);
- if (priv->pRCBMem == NULL) {
- dev_err(&priv->usb->dev, "alloc rx usb context failed\n");
- goto free_tx;
- }
-
- priv->FirstRecvFreeList = NULL;
- priv->LastRecvFreeList = NULL;
- priv->NumRecvFreeList = 0;
+ for (ii = 0; ii < priv->cbRD; ii++) {
+ priv->apRCB[ii] = kzalloc(sizeof(struct vnt_rcb), GFP_KERNEL);
+ if (!priv->apRCB[ii]) {
+ dev_err(&priv->usb->dev,
+ "failed to allocate rcb no %d\n", ii);
+ goto free_rx_tx;
+ }
- rcb = (struct vnt_rcb *)priv->pRCBMem;
+ rcb = priv->apRCB[ii];
- for (ii = 0; ii < priv->cbRD; ii++) {
- priv->apRCB[ii] = rcb;
rcb->pDevice = priv;
/* allocate URBs */
@@ -611,11 +607,9 @@ static bool device_alloc_bufs(struct vnt_private *priv)
rcb->bBoolInUse = false;
- EnqueueRCB(priv->FirstRecvFreeList,
- priv->LastRecvFreeList, rcb);
-
- priv->NumRecvFreeList++;
- rcb++;
+ /* submit rx urb */
+ if (PIPEnsBulkInUsbRead(priv, rcb))
+ goto free_rx_tx;
}
priv->pInterruptURB = usb_alloc_urb(0, GFP_ATOMIC);
@@ -678,7 +672,6 @@ static int vnt_start(struct ieee80211_hw *hw)
priv->int_interval = 1; /* bInterval is set to 1 */
- schedule_work(&priv->read_work_item);
INTvWorkItem(priv);
priv->flags |= DEVICE_FLAGS_OPENED;
@@ -722,7 +715,6 @@ static void vnt_stop(struct ieee80211_hw *hw)
MP_CLEAR_FLAG(priv, fMP_POST_READS);
cancel_delayed_work_sync(&priv->run_command_work);
- cancel_work_sync(&priv->read_work_item);
priv->bCmdRunning = false;
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index 6a7e692..428193e 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -230,9 +230,6 @@ int PIPEnsBulkInUsbRead(struct vnt_private *priv, struct vnt_rcb *rcb)
int status = 0;
struct urb *urb;
- if (priv->Flags & fMP_DISCONNECTED)
- return STATUS_FAILURE;
-
urb = rcb->pUrb;
if (rcb->skb == NULL) {
dev_dbg(&priv->usb->dev, "rcb->skb is null\n");
@@ -303,16 +300,24 @@ static void s_nsBulkInUsbIoCompleteRead(struct urb *urb)
spin_unlock_irqrestore(&priv->lock, flags);
}
- rcb->Ref--;
- if (rcb->Ref == 0) {
- dev_dbg(&priv->usb->dev,
- "RxvFreeNormal %d\n", priv->NumRecvFreeList);
+ if (re_alloc_skb) {
+ rcb->skb = dev_alloc_skb(priv->rx_buf_sz);
+ if (!rcb->skb) {
+ dev_dbg(&priv->usb->dev, "Failed to re-alloc rx skb\n");
- spin_lock_irqsave(&priv->lock, flags);
+ rcb->bBoolInUse = false;
- RXvFreeRCB(rcb, re_alloc_skb);
+ return;
+ }
- spin_unlock_irqrestore(&priv->lock, flags);
+ urb->transfer_buffer = skb_put(rcb->skb,
+ skb_tailroom(rcb->skb));
+ }
+
+ if (usb_submit_urb(urb, GFP_ATOMIC)) {
+ dev_dbg(&priv->usb->dev, "Failed to re submit rx skb\n");
+
+ rcb->bBoolInUse = false;
}
return;
--
1.9.1
This is assigned later in function and should have been removed in
an out-of-tree merge.
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/rxtx.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 5513121..e896dfe5d 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -929,9 +929,6 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb)
frame_size = tx_body_size + 4;
- /* Set time stamp */
- tx_buffer_head->time_stamp = cpu_to_le16(DEFAULT_MGN_LIFETIME_RES_64us);
-
/*Set fifo controls */
if (pkt_type == PK_TYPE_11A)
tx_buffer_head->wFIFOCtl = 0;
--
1.9.1
Use base type to __le16 and do endian correction.
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/rxtx.c | 12 ++++++------
drivers/staging/vt6656/rxtx.h | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index f4833ff..5513121 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -978,21 +978,21 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb)
if (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER)
is_pspoll = true;
- tx_buffer_head->wFragCtl =
- cpu_to_le16(ieee80211_get_hdrlen_from_skb(skb)) << 10;
+ tx_buffer_head->frag_ctl =
+ cpu_to_le16(ieee80211_get_hdrlen_from_skb(skb) << 10);
if (info->control.hw_key) {
tx_key = info->control.hw_key;
switch (info->control.hw_key->cipher) {
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
- tx_buffer_head->wFragCtl |= FRAGCTL_LEGACY;
+ tx_buffer_head->frag_ctl |= cpu_to_le16(FRAGCTL_LEGACY);
break;
case WLAN_CIPHER_SUITE_TKIP:
- tx_buffer_head->wFragCtl |= FRAGCTL_TKIP;
+ tx_buffer_head->frag_ctl |= cpu_to_le16(FRAGCTL_TKIP);
break;
case WLAN_CIPHER_SUITE_CCMP:
- tx_buffer_head->wFragCtl |= FRAGCTL_AES;
+ tx_buffer_head->frag_ctl |= cpu_to_le16(FRAGCTL_AES);
need_mic = true;
default:
break;
@@ -1033,7 +1033,7 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb)
return -ENOMEM;
}
- tx_buffer_head->wFragCtl |= (u16)FRAGCTL_NONFRAG;
+ tx_buffer_head->frag_ctl |= cpu_to_le16(FRAGCTL_NONFRAG);
tx_bytes = tx_header_size + tx_body_size;
diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h
index 26dc21c..1cfa5ae 100644
--- a/drivers/staging/vt6656/rxtx.h
+++ b/drivers/staging/vt6656/rxtx.h
@@ -224,7 +224,7 @@ struct vnt_tx_fifo_head {
u8 tx_key[WLAN_KEY_LEN_CCMP];
u16 wFIFOCtl;
__le16 time_stamp;
- u16 wFragCtl;
+ __le16 frag_ctl;
__le16 current_rate;
} __packed;
--
1.9.1