2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 * Purpose: Handle USB interrupt endpoint
31 * 04-02-2004 Jerry Chen: Initial release
42 static int msglevel = MSG_LEVEL_INFO; /* MSG_LEVEL_DEBUG */
46 * Function: InterruptPollingThread
48 * Synopsis: Thread running at IRQL PASSIVE_LEVEL.
50 * Arguments: Device Extension
54 * Algorithm: Call USBD for input data;
56 * History: dd-mm-yyyy Author Comment
61 * USB reads are by nature 'Blocking', and when in a read, the device looks
62 * like it's in a 'stall' condition, so we deliberately time out every second
63 * if we've gotten no data
66 void INTvWorkItem(struct vnt_private *pDevice)
71 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Interrupt Polling Thread\n");
73 spin_lock_irqsave(&pDevice->lock, flags);
75 ntStatus = PIPEnsInterruptRead(pDevice);
77 spin_unlock_irqrestore(&pDevice->lock, flags);
80 void INTnsProcessData(struct vnt_private *priv)
82 struct vnt_interrupt_data *int_data;
83 struct vnt_manager *mgmt = &priv->vnt_mgmt;
84 struct net_device_stats *stats = &priv->stats;
86 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptProcessData\n");
88 int_data = (struct vnt_interrupt_data *)priv->int_buf.data_buf;
90 if (int_data->tsr0 & TSR_VALID) {
91 if (int_data->tsr0 & (TSR_TMO | TSR_RETRYTMO))
92 priv->wstats.discard.retries++;
96 BSSvUpdateNodeTxCounter(priv,
101 if (int_data->tsr1 & TSR_VALID) {
102 if (int_data->tsr1 & (TSR_TMO | TSR_RETRYTMO))
103 priv->wstats.discard.retries++;
108 BSSvUpdateNodeTxCounter(priv,
113 if (int_data->tsr2 & TSR_VALID) {
114 if (int_data->tsr2 & (TSR_TMO | TSR_RETRYTMO))
115 priv->wstats.discard.retries++;
119 BSSvUpdateNodeTxCounter(priv,
124 if (int_data->tsr3 & TSR_VALID) {
125 if (int_data->tsr3 & (TSR_TMO | TSR_RETRYTMO))
126 priv->wstats.discard.retries++;
130 BSSvUpdateNodeTxCounter(priv,
135 if (int_data->isr0 != 0) {
136 if (int_data->isr0 & ISR_BNTX) {
137 if (priv->op_mode == NL80211_IFTYPE_AP) {
138 if (mgmt->byDTIMCount > 0) {
140 mgmt->sNodeDBTable[0].bRxPSPoll =
142 } else if (mgmt->byDTIMCount == 0) {
143 /* check if multicast tx buffering */
145 mgmt->byDTIMPeriod-1;
146 mgmt->sNodeDBTable[0].bRxPSPoll = true;
147 if (mgmt->sNodeDBTable[0].bPSEnable)
148 bScheduleCommand((void *) priv,
152 bScheduleCommand((void *) priv,
156 priv->bBeaconSent = true;
158 priv->bBeaconSent = false;
161 if (int_data->isr0 & ISR_TBTT) {
162 if (priv->bEnablePSMode)
163 bScheduleCommand((void *) priv,
164 WLAN_CMD_TBTT_WAKEUP,
166 if (priv->bChannelSwitch) {
167 priv->byChannelSwitchCount--;
168 if (priv->byChannelSwitchCount == 0)
169 bScheduleCommand((void *) priv,
174 priv->qwCurrTSF = le64_to_cpu(int_data->tsf);
177 if (int_data->isr1 != 0)
178 if (int_data->isr1 & ISR_GPIO3)
179 bScheduleCommand((void *) priv,
183 priv->int_buf.in_use = false;
185 stats->tx_errors = priv->wstats.discard.retries;
186 stats->tx_dropped = priv->wstats.discard.retries;