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
|
|
|
{
|
2014-05-24 07:36:57 -06:00
|
|
|
unsigned long flags;
|
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
|
|
|
|
2014-05-24 07:36:57 -06:00
|
|
|
spin_lock_irqsave(&pDevice->lock, flags);
|
2014-02-17 14:24:33 -07:00
|
|
|
|
|
|
|
ntStatus = PIPEnsInterruptRead(pDevice);
|
|
|
|
|
2014-05-24 07:36:57 -06:00
|
|
|
spin_unlock_irqrestore(&pDevice->lock, flags);
|
2010-03-29 07:28:19 -06:00
|
|
|
}
|
2009-06-13 05:38:31 -06:00
|
|
|
|
2014-02-16 12:10:18 -07:00
|
|
|
void INTnsProcessData(struct vnt_private *priv)
|
2009-06-13 05:38:31 -06:00
|
|
|
{
|
2014-02-16 12:10:18 -07:00
|
|
|
struct vnt_interrupt_data *int_data;
|
|
|
|
struct vnt_manager *mgmt = &priv->vnt_mgmt;
|
|
|
|
struct net_device_stats *stats = &priv->stats;
|
2010-03-29 07:28:19 -06:00
|
|
|
|
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptProcessData\n");
|
|
|
|
|
2014-02-19 11:39:09 -07:00
|
|
|
int_data = (struct vnt_interrupt_data *)priv->int_buf.data_buf;
|
2014-02-16 12:10:18 -07:00
|
|
|
|
|
|
|
if (int_data->tsr0 & TSR_VALID) {
|
|
|
|
if (int_data->tsr0 & (TSR_TMO | TSR_RETRYTMO))
|
|
|
|
priv->wstats.discard.retries++;
|
2013-12-09 15:23:19 -07:00
|
|
|
else
|
2014-02-16 12:10:18 -07:00
|
|
|
stats->tx_packets++;
|
2013-12-09 15:23:19 -07:00
|
|
|
|
2014-02-16 12:10:18 -07:00
|
|
|
BSSvUpdateNodeTxCounter(priv,
|
|
|
|
int_data->tsr0,
|
|
|
|
int_data->pkt0);
|
2010-03-29 07:28:19 -06:00
|
|
|
}
|
2014-02-16 12:10:18 -07:00
|
|
|
|
|
|
|
if (int_data->tsr1 & TSR_VALID) {
|
|
|
|
if (int_data->tsr1 & (TSR_TMO | TSR_RETRYTMO))
|
|
|
|
priv->wstats.discard.retries++;
|
2013-12-09 15:23:19 -07:00
|
|
|
else
|
2014-02-16 12:10:18 -07:00
|
|
|
stats->tx_packets++;
|
2013-12-09 15:23:19 -07:00
|
|
|
|
|
|
|
|
2014-02-16 12:10:18 -07:00
|
|
|
BSSvUpdateNodeTxCounter(priv,
|
|
|
|
int_data->tsr1,
|
|
|
|
int_data->pkt1);
|
2010-03-29 07:28:19 -06:00
|
|
|
}
|
2014-02-16 12:10:18 -07:00
|
|
|
|
|
|
|
if (int_data->tsr2 & TSR_VALID) {
|
|
|
|
if (int_data->tsr2 & (TSR_TMO | TSR_RETRYTMO))
|
|
|
|
priv->wstats.discard.retries++;
|
2013-12-09 15:23:19 -07:00
|
|
|
else
|
2014-02-16 12:10:18 -07:00
|
|
|
stats->tx_packets++;
|
2013-12-09 15:23:19 -07:00
|
|
|
|
2014-02-16 12:10:18 -07:00
|
|
|
BSSvUpdateNodeTxCounter(priv,
|
|
|
|
int_data->tsr2,
|
|
|
|
int_data->pkt2);
|
2010-03-29 07:28:19 -06:00
|
|
|
}
|
2014-02-16 12:10:18 -07:00
|
|
|
|
|
|
|
if (int_data->tsr3 & TSR_VALID) {
|
|
|
|
if (int_data->tsr3 & (TSR_TMO | TSR_RETRYTMO))
|
|
|
|
priv->wstats.discard.retries++;
|
2013-12-09 15:23:19 -07:00
|
|
|
else
|
2014-02-16 12:10:18 -07:00
|
|
|
stats->tx_packets++;
|
2013-12-09 15:23:19 -07:00
|
|
|
|
2014-02-16 12:10:18 -07:00
|
|
|
BSSvUpdateNodeTxCounter(priv,
|
|
|
|
int_data->tsr3,
|
|
|
|
int_data->pkt3);
|
2010-03-29 07:28:19 -06:00
|
|
|
}
|
2014-02-16 12:10:18 -07:00
|
|
|
|
|
|
|
if (int_data->isr0 != 0) {
|
|
|
|
if (int_data->isr0 & ISR_BNTX) {
|
|
|
|
if (priv->op_mode == NL80211_IFTYPE_AP) {
|
|
|
|
if (mgmt->byDTIMCount > 0) {
|
|
|
|
mgmt->byDTIMCount--;
|
|
|
|
mgmt->sNodeDBTable[0].bRxPSPoll =
|
2013-02-12 18:36:29 -07:00
|
|
|
false;
|
2014-02-16 12:10:18 -07:00
|
|
|
} else if (mgmt->byDTIMCount == 0) {
|
2012-08-26 09:16:43 -06:00
|
|
|
/* check if multicast tx buffering */
|
2014-02-16 12:10:18 -07:00
|
|
|
mgmt->byDTIMCount =
|
|
|
|
mgmt->byDTIMPeriod-1;
|
|
|
|
mgmt->sNodeDBTable[0].bRxPSPoll = true;
|
|
|
|
if (mgmt->sNodeDBTable[0].bPSEnable)
|
|
|
|
bScheduleCommand((void *) priv,
|
2010-05-06 17:34:29 -06:00
|
|
|
WLAN_CMD_RX_PSPOLL,
|
|
|
|
NULL);
|
2010-03-29 07:28:19 -06:00
|
|
|
}
|
2014-02-16 12:10:18 -07:00
|
|
|
bScheduleCommand((void *) priv,
|
2010-03-29 07:28:19 -06:00
|
|
|
WLAN_CMD_BECON_SEND,
|
|
|
|
NULL);
|
2014-02-15 14:56:20 -07:00
|
|
|
}
|
2014-02-16 12:10:18 -07:00
|
|
|
priv->bBeaconSent = true;
|
2010-03-29 07:28:19 -06:00
|
|
|
} else {
|
2014-02-16 12:10:18 -07:00
|
|
|
priv->bBeaconSent = false;
|
2010-03-29 07:28:19 -06:00
|
|
|
}
|
2014-02-16 12:10:18 -07:00
|
|
|
|
|
|
|
if (int_data->isr0 & ISR_TBTT) {
|
|
|
|
if (priv->bEnablePSMode)
|
|
|
|
bScheduleCommand((void *) priv,
|
2010-03-29 07:28:19 -06:00
|
|
|
WLAN_CMD_TBTT_WAKEUP,
|
|
|
|
NULL);
|
2014-02-16 12:10:18 -07:00
|
|
|
if (priv->bChannelSwitch) {
|
|
|
|
priv->byChannelSwitchCount--;
|
|
|
|
if (priv->byChannelSwitchCount == 0)
|
|
|
|
bScheduleCommand((void *) priv,
|
2010-03-29 07:28:19 -06:00
|
|
|
WLAN_CMD_11H_CHSW,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
}
|
2014-02-16 12:10:18 -07:00
|
|
|
priv->qwCurrTSF = le64_to_cpu(int_data->tsf);
|
2010-03-29 07:28:19 -06:00
|
|
|
}
|
2014-02-16 12:10:18 -07:00
|
|
|
|
|
|
|
if (int_data->isr1 != 0)
|
|
|
|
if (int_data->isr1 & ISR_GPIO3)
|
|
|
|
bScheduleCommand((void *) priv,
|
2010-03-29 07:28:19 -06:00
|
|
|
WLAN_CMD_RADIO,
|
|
|
|
NULL);
|
2014-02-19 11:39:09 -07:00
|
|
|
|
|
|
|
priv->int_buf.in_use = false;
|
2010-03-29 07:28:19 -06:00
|
|
|
|
2014-02-16 12:10:18 -07:00
|
|
|
stats->tx_errors = priv->wstats.discard.retries;
|
|
|
|
stats->tx_dropped = priv->wstats.discard.retries;
|
2009-06-13 05:38:31 -06:00
|
|
|
}
|