2009-06-13 05:38:31 -06:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* File: int.c
|
|
|
|
*
|
|
|
|
* Purpose: Handle USB interrupt endpoint
|
|
|
|
*
|
|
|
|
* Author: Jerry Chen
|
|
|
|
*
|
|
|
|
* Date: Apr. 2, 2004
|
|
|
|
*
|
|
|
|
* Functions:
|
|
|
|
*
|
|
|
|
* Revision History:
|
|
|
|
* 04-02-2004 Jerry Chen: Initial release
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "int.h"
|
|
|
|
#include "tmacro.h"
|
|
|
|
#include "mac.h"
|
|
|
|
#include "power.h"
|
|
|
|
#include "bssdb.h"
|
|
|
|
#include "usbpipe.h"
|
|
|
|
|
2012-06-27 14:01:18 -06:00
|
|
|
static int msglevel = MSG_LEVEL_INFO; /* MSG_LEVEL_DEBUG */
|
2009-06-13 05:38:31 -06:00
|
|
|
|
|
|
|
/*+
|
|
|
|
*
|
|
|
|
* Function: InterruptPollingThread
|
|
|
|
*
|
|
|
|
* Synopsis: Thread running at IRQL PASSIVE_LEVEL.
|
|
|
|
*
|
|
|
|
* Arguments: Device Extension
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
*
|
|
|
|
* Algorithm: Call USBD for input data;
|
|
|
|
*
|
|
|
|
* History: dd-mm-yyyy Author Comment
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Notes:
|
|
|
|
*
|
2010-03-29 07:28:19 -06:00
|
|
|
* USB reads are by nature 'Blocking', and when in a read, the device looks
|
|
|
|
* like it's in a 'stall' condition, so we deliberately time out every second
|
|
|
|
* if we've gotten no data
|
2009-06-13 05:38:31 -06:00
|
|
|
*
|
|
|
|
-*/
|
2012-12-10 15:14:36 -07:00
|
|
|
void INTvWorkItem(struct vnt_private *pDevice)
|
2009-06-13 05:38:31 -06:00
|
|
|
{
|
2010-08-02 17:51:57 -06:00
|
|
|
int ntStatus;
|
2009-06-13 05:38:31 -06:00
|
|
|
|
2010-03-29 07:28:19 -06:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Interrupt Polling Thread\n");
|
2009-06-13 05:38:31 -06:00
|
|
|
|
2010-03-29 07:28:19 -06:00
|
|
|
spin_lock_irq(&pDevice->lock);
|
2013-02-12 18:36:30 -07:00
|
|
|
if (pDevice->fKillEventPollingThread != true)
|
2010-03-29 07:28:19 -06:00
|
|
|
ntStatus = PIPEnsInterruptRead(pDevice);
|
|
|
|
spin_unlock_irq(&pDevice->lock);
|
|
|
|
}
|
2009-06-13 05:38:31 -06:00
|
|
|
|
2012-12-10 15:14:36 -07:00
|
|
|
void INTnsProcessData(struct vnt_private *pDevice)
|
2009-06-13 05:38:31 -06:00
|
|
|
{
|
2012-06-27 14:02:19 -06:00
|
|
|
PSINTData pINTData;
|
2012-12-10 15:14:36 -07:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2010-03-29 07:28:19 -06:00
|
|
|
struct net_device_stats *pStats = &pDevice->stats;
|
|
|
|
|
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptProcessData\n");
|
|
|
|
|
|
|
|
pINTData = (PSINTData) pDevice->intBuf.pDataBuf;
|
|
|
|
if (pINTData->byTSR0 & TSR_VALID) {
|
2013-12-09 15:23:19 -07:00
|
|
|
if (pINTData->byTSR0 & (TSR_TMO | TSR_RETRYTMO))
|
|
|
|
pDevice->wstats.discard.retries++;
|
|
|
|
else
|
|
|
|
pStats->tx_packets++;
|
|
|
|
|
2010-03-29 07:28:19 -06:00
|
|
|
BSSvUpdateNodeTxCounter(pDevice,
|
|
|
|
pINTData->byTSR0,
|
|
|
|
pINTData->byPkt0);
|
|
|
|
/*DBG_PRN_GRP01(("TSR0 %02x\n", pINTData->byTSR0));*/
|
|
|
|
}
|
|
|
|
if (pINTData->byTSR1 & TSR_VALID) {
|
2013-12-09 15:23:19 -07:00
|
|
|
if (pINTData->byTSR1 & (TSR_TMO | TSR_RETRYTMO))
|
|
|
|
pDevice->wstats.discard.retries++;
|
|
|
|
else
|
|
|
|
pStats->tx_packets++;
|
|
|
|
|
|
|
|
|
2010-03-29 07:28:19 -06:00
|
|
|
BSSvUpdateNodeTxCounter(pDevice,
|
|
|
|
pINTData->byTSR1,
|
|
|
|
pINTData->byPkt1);
|
|
|
|
/*DBG_PRN_GRP01(("TSR1 %02x\n", pINTData->byTSR1));*/
|
|
|
|
}
|
|
|
|
if (pINTData->byTSR2 & TSR_VALID) {
|
2013-12-09 15:23:19 -07:00
|
|
|
if (pINTData->byTSR2 & (TSR_TMO | TSR_RETRYTMO))
|
|
|
|
pDevice->wstats.discard.retries++;
|
|
|
|
else
|
|
|
|
pStats->tx_packets++;
|
|
|
|
|
2010-03-29 07:28:19 -06:00
|
|
|
BSSvUpdateNodeTxCounter(pDevice,
|
|
|
|
pINTData->byTSR2,
|
|
|
|
pINTData->byPkt2);
|
|
|
|
/*DBG_PRN_GRP01(("TSR2 %02x\n", pINTData->byTSR2));*/
|
|
|
|
}
|
|
|
|
if (pINTData->byTSR3 & TSR_VALID) {
|
2013-12-09 15:23:19 -07:00
|
|
|
if (pINTData->byTSR3 & (TSR_TMO | TSR_RETRYTMO))
|
|
|
|
pDevice->wstats.discard.retries++;
|
|
|
|
else
|
|
|
|
pStats->tx_packets++;
|
|
|
|
|
2010-03-29 07:28:19 -06:00
|
|
|
BSSvUpdateNodeTxCounter(pDevice,
|
|
|
|
pINTData->byTSR3,
|
|
|
|
pINTData->byPkt3);
|
|
|
|
/*DBG_PRN_GRP01(("TSR3 %02x\n", pINTData->byTSR3));*/
|
|
|
|
}
|
|
|
|
if (pINTData->byISR0 != 0) {
|
|
|
|
if (pINTData->byISR0 & ISR_BNTX) {
|
|
|
|
if (pDevice->eOPMode == OP_MODE_AP) {
|
|
|
|
if (pMgmt->byDTIMCount > 0) {
|
|
|
|
pMgmt->byDTIMCount--;
|
|
|
|
pMgmt->sNodeDBTable[0].bRxPSPoll =
|
2013-02-12 18:36:29 -07:00
|
|
|
false;
|
2010-03-29 07:28:19 -06:00
|
|
|
} else if (pMgmt->byDTIMCount == 0) {
|
2012-08-26 09:16:43 -06:00
|
|
|
/* check if multicast tx buffering */
|
2010-03-29 07:28:19 -06:00
|
|
|
pMgmt->byDTIMCount =
|
|
|
|
pMgmt->byDTIMPeriod-1;
|
2013-02-12 18:36:30 -07:00
|
|
|
pMgmt->sNodeDBTable[0].bRxPSPoll = true;
|
2010-03-29 07:28:19 -06:00
|
|
|
if (pMgmt->sNodeDBTable[0].bPSEnable)
|
2010-05-06 17:34:29 -06:00
|
|
|
bScheduleCommand((void *) pDevice,
|
|
|
|
WLAN_CMD_RX_PSPOLL,
|
|
|
|
NULL);
|
2010-03-29 07:28:19 -06:00
|
|
|
}
|
2010-05-06 17:34:29 -06:00
|
|
|
bScheduleCommand((void *) pDevice,
|
2010-03-29 07:28:19 -06:00
|
|
|
WLAN_CMD_BECON_SEND,
|
|
|
|
NULL);
|
|
|
|
} /* if (pDevice->eOPMode == OP_MODE_AP) */
|
2013-02-12 18:36:30 -07:00
|
|
|
pDevice->bBeaconSent = true;
|
2010-03-29 07:28:19 -06:00
|
|
|
} else {
|
2013-02-12 18:36:29 -07:00
|
|
|
pDevice->bBeaconSent = false;
|
2010-03-29 07:28:19 -06:00
|
|
|
}
|
|
|
|
if (pINTData->byISR0 & ISR_TBTT) {
|
|
|
|
if (pDevice->bEnablePSMode)
|
2010-05-06 17:34:29 -06:00
|
|
|
bScheduleCommand((void *) pDevice,
|
2010-03-29 07:28:19 -06:00
|
|
|
WLAN_CMD_TBTT_WAKEUP,
|
|
|
|
NULL);
|
|
|
|
if (pDevice->bChannelSwitch) {
|
|
|
|
pDevice->byChannelSwitchCount--;
|
|
|
|
if (pDevice->byChannelSwitchCount == 0)
|
2010-05-06 17:34:29 -06:00
|
|
|
bScheduleCommand((void *) pDevice,
|
2010-03-29 07:28:19 -06:00
|
|
|
WLAN_CMD_11H_CHSW,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 14:11:02 -07:00
|
|
|
pDevice->qwCurrTSF = cpu_to_le64(pINTData->qwTSF);
|
2010-03-29 07:28:19 -06:00
|
|
|
/*DBG_PRN_GRP01(("ISR0 = %02x ,
|
2012-06-27 14:03:30 -06:00
|
|
|
LoTsf = %08x,
|
|
|
|
HiTsf = %08x\n",
|
|
|
|
pINTData->byISR0,
|
|
|
|
pINTData->dwLoTSF,
|
|
|
|
pINTData->dwHiTSF)); */
|
2010-03-29 07:28:19 -06:00
|
|
|
}
|
|
|
|
if (pINTData->byISR1 != 0)
|
|
|
|
if (pINTData->byISR1 & ISR_GPIO3)
|
2010-05-06 17:34:29 -06:00
|
|
|
bScheduleCommand((void *) pDevice,
|
2010-03-29 07:28:19 -06:00
|
|
|
WLAN_CMD_RADIO,
|
|
|
|
NULL);
|
|
|
|
pDevice->intBuf.uDataLen = 0;
|
2013-02-12 18:36:29 -07:00
|
|
|
pDevice->intBuf.bInUse = false;
|
2010-03-29 07:28:19 -06:00
|
|
|
|
2013-12-09 15:23:19 -07:00
|
|
|
pStats->tx_errors = pDevice->wstats.discard.retries;
|
|
|
|
pStats->tx_dropped = pDevice->wstats.discard.retries;
|
2009-06-13 05:38:31 -06:00
|
|
|
}
|