staging: vt6656: device.h convert sTimerCommand to delayed_work

timer to delay workqueue.
sTimerCommand -> run_command_work

sTimerCommand is very heavy on the system timer.

Improves over performance of driver and reduce the atomic
area of driver.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Malcolm Priestley 2013-09-27 16:48:14 +01:00 committed by Greg Kroah-Hartman
parent b20204310a
commit 94488a7ebf
5 changed files with 16 additions and 37 deletions

View file

@ -707,7 +707,7 @@ struct vnt_private {
u8 byBBCR09;
/* command timer */
struct timer_list sTimerCommand;
struct delayed_work run_command_work;
struct timer_list sTimerTxData;
unsigned long nTxDataTimeCout;

View file

@ -702,6 +702,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id)
device_set_options(pDevice);
spin_lock_init(&pDevice->lock);
INIT_DELAYED_WORK(&pDevice->run_command_work, vRunCommand);
pDevice->tx_80211 = device_dma0_tx_80211;
pDevice->vnt_mgmt.pAdapter = (void *) pDevice;
@ -1076,7 +1077,9 @@ static int device_close(struct net_device *dev)
MP_CLEAR_FLAG(pDevice, fMP_POST_WRITES);
MP_CLEAR_FLAG(pDevice, fMP_POST_READS);
pDevice->fKillEventPollingThread = true;
del_timer(&pDevice->sTimerCommand);
cancel_delayed_work_sync(&pDevice->run_command_work);
del_timer(&pMgmt->sTimerSecondCallback);
del_timer(&pDevice->sTimerTxData);

View file

@ -268,20 +268,14 @@ struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice,
void vCommandTimerWait(struct vnt_private *pDevice, unsigned long MSecond)
{
init_timer(&pDevice->sTimerCommand);
pDevice->sTimerCommand.data = (unsigned long)pDevice;
pDevice->sTimerCommand.function = (TimerFunction)vRunCommand;
pDevice->sTimerCommand.expires = RUN_AT((MSecond * HZ) / 1000);
add_timer(&pDevice->sTimerCommand);
return;
schedule_delayed_work(&pDevice->run_command_work,
msecs_to_jiffies(MSecond));
}
void vRunCommand(struct vnt_private *pDevice)
void vRunCommand(struct work_struct *work)
{
struct vnt_private *pDevice =
container_of(work, struct vnt_private, run_command_work.work);
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
PWLAN_IE_SSID pItemSSID;
PWLAN_IE_SSID pItemSSIDCurr;
@ -1156,14 +1150,8 @@ static int s_bClearBSSID_SCAN(struct vnt_private *pDevice)
//mike add:reset command timer
void vResetCommandTimer(struct vnt_private *pDevice)
{
cancel_delayed_work_sync(&pDevice->run_command_work);
//delete timer
del_timer(&pDevice->sTimerCommand);
//init timer
init_timer(&pDevice->sTimerCommand);
pDevice->sTimerCommand.data = (unsigned long)pDevice;
pDevice->sTimerCommand.function = (TimerFunction)vRunCommand;
pDevice->sTimerCommand.expires = RUN_AT(HZ);
pDevice->cbFreeCmdQueue = CMD_Q_SIZE;
pDevice->uCmdDequeueIdx = 0;
pDevice->uCmdEnqueueIdx = 0;

View file

@ -105,14 +105,7 @@ void vResetCommandTimer(struct vnt_private *);
int bScheduleCommand(struct vnt_private *, CMD_CODE eCommand, u8 *pbyItem0);
void vRunCommand(struct vnt_private *);
/*
void
WCMDvCommandThread(
void * Context
);
*/
void vRunCommand(struct work_struct *work);
void BSSvSecondTxData(struct vnt_private *);

View file

@ -218,11 +218,6 @@ void vMgrObjectInit(struct vnt_private *pDevice)
pMgmt->sTimerSecondCallback.function = (TimerFunction)BSSvSecondCallBack;
pMgmt->sTimerSecondCallback.expires = RUN_AT(HZ);
init_timer(&pDevice->sTimerCommand);
pDevice->sTimerCommand.data = (unsigned long)pDevice;
pDevice->sTimerCommand.function = (TimerFunction)vRunCommand;
pDevice->sTimerCommand.expires = RUN_AT(HZ);
init_timer(&pDevice->sTimerTxData);
pDevice->sTimerTxData.data = (unsigned long)pDevice;
pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData;
@ -844,8 +839,8 @@ static void s_vMgrRxAssocResponse(struct vnt_private *pDevice,
pDevice->bwextstep3 = false;
pDevice->bWPASuppWextEnabled = false;
if(pMgmt->eCurrState == WMAC_STATE_ASSOC)
timer_expire(pDevice->sTimerCommand, 0);
if (pMgmt->eCurrState == WMAC_STATE_ASSOC)
schedule_delayed_work(&pDevice->run_command_work, 0);
return;
}
@ -1127,7 +1122,7 @@ static void s_vMgrRxAuthenSequence_2(struct vnt_private *pDevice,
if ( cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS ){
DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Successful.\n");
pMgmt->eCurrState = WMAC_STATE_AUTH;
timer_expire(pDevice->sTimerCommand, 0);
schedule_delayed_work(&pDevice->run_command_work, 0);
}
else {
DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Failed.\n");
@ -1302,7 +1297,7 @@ static void s_vMgrRxAuthenSequence_4(struct vnt_private *pDevice,
if ( cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS ){
DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Successful.\n");
pMgmt->eCurrState = WMAC_STATE_AUTH;
timer_expire(pDevice->sTimerCommand, 0);
schedule_delayed_work(&pDevice->run_command_work, 0);
}
else{
DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Failed.\n");