staging: vt6656: rxtx struct vnt_mic_hdr change tsc_47_16/tsc_15_0
PATCH 1/8 staging: vt6656: rxtx struct vnt_mic_hdr change tsc_47_16/tsc_15_0
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.
--- drivers/staging/vt6656/rxtx.c | 8 +------- drivers/staging/vt6656/rxtx.h | 3 +-- 2 files changed, 2 insertions(+), 9 deletions(-)
drivers/staging/vt6656/rxtx.c +1 -7
@@ -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 );
drivers/staging/vt6656/rxtx.h +1 -2
@@ -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;
Signature · 1 line
1.9.1
PATCH 2/8 staging: vt6656: rxtx replace wFragCtl with frag_ctl.
Use base type to __le16 and do endian correction.
--- drivers/staging/vt6656/rxtx.c | 12 ++++++------ drivers/staging/vt6656/rxtx.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/vt6656/rxtx.c +6 -6
@@ -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;
drivers/staging/vt6656/rxtx.h +1 -1
@@ -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;
Signature · 1 line
1.9.1
PATCH 3/8 staging: vt6656: vnt_tx_packet remove first assignment of time_stamp.
In reply to Malcolm PriestleyThis is assigned later in function and should have been removed in an out-of-tree merge.
--- drivers/staging/vt6656/rxtx.c | 3 --- 1 file changed, 3 deletions(-)
drivers/staging/vt6656/rxtx.c +0 -3
@@ -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 ;
Signature · 1 line
1.9.1
PATCH 4/8 staging: vt6656: Remove rx handing from RXvWorkItem
In reply to Malcolm PriestleyIn 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.
--- drivers/staging/vt6656/main_usb.c | 38 +++++++++++++++----------------------- drivers/staging/vt6656/usbpipe.c | 25 +++++++++++++++---------- 2 files changed, 30 insertions(+), 33 deletions(-)
drivers/staging/vt6656/main_usb.c +15 -23
@@ -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;
drivers/staging/vt6656/usbpipe.c +15 -10
@@ -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 ;
Signature · 1 line
1.9.1
PATCH 5/8 staging: vt6656: dead code remove RXvWorkItem and RXvFreeRCB
In reply to Malcolm PriestleyRemove work_struct and queue variables
Remove EnqueueRCB and DequeueRCB macros
--- drivers/staging/vt6656/device.h | 29 ----------------- drivers/staging/vt6656/dpc.c | 68 --------------------------------------- drivers/staging/vt6656/main_usb.c | 1 - 3 files changed, 98 deletions(-)
drivers/staging/vt6656/device.h +0 -29
@@ -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; \
drivers/staging/vt6656/dpc.c +0 -68
74 lines not on this page · raw message
drivers/staging/vt6656/main_usb.c +0 -1
@@ -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);
Signature · 1 line
1.9.1
PATCH 6/8 staging: vt6656: remove vnt_add_basic_rate
In reply to Malcolm PriestleyThe driver never sets basic rate any more so remove function.
--- 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(-)
drivers/staging/vt6656/card.c +0 -22
@@ -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;
drivers/staging/vt6656/card.h +0 -1
@@ -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 *);
drivers/staging/vt6656/main_usb.c +2 -5
@@ -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);
Signature · 1 line
1.9.1
PATCH 7/8 staging: vt6656: set BBvSetVGAGainOffset inside vnt_set_bss_mode
In reply to Malcolm Priestleyvnt_set_bss_mode changes the state of abyBBVGA so move BBvSetVGAGainOffset to the function.
--- drivers/staging/vt6656/card.c | 2 ++ drivers/staging/vt6656/main_usb.c | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/staging/vt6656/card.c +2 -0
@@ -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 ]); }
drivers/staging/vt6656/main_usb.c +0 -5
@@ -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;
Signature · 1 line
1.9.1
PATCH 8/8 staging: vt6656: device_init_registers move out vnt_set_bss_mode
In reply to Malcolm PriestleyMove to vnt_add_interface and allow to refresh at the start of every software scan in vnt_sw_scan_start
--- drivers/staging/vt6656/main_usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/vt6656/main_usb.c +3 -1
@@ -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); }
Signature · 1 line
1.9.1