Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. |
| 3 | * All rights reserved. |
| 4 | * |
| 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. |
| 9 | * |
| 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. |
| 14 | * |
| 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. |
| 18 | * |
| 19 | * |
| 20 | * File: usbpipe.c |
| 21 | * |
| 22 | * Purpose: Handle USB control endpoint |
| 23 | * |
| 24 | * Author: Warren Hsu |
| 25 | * |
| 26 | * Date: Mar. 29, 2005 |
| 27 | * |
| 28 | * Functions: |
| 29 | * CONTROLnsRequestOut - Write variable length bytes to MEM/BB/MAC/EEPROM |
| 30 | * CONTROLnsRequestIn - Read variable length bytes from MEM/BB/MAC/EEPROM |
| 31 | * ControlvWriteByte - Write one byte to MEM/BB/MAC/EEPROM |
| 32 | * ControlvReadByte - Read one byte from MEM/BB/MAC/EEPROM |
| 33 | * ControlvMaskByte - Read one byte from MEM/BB/MAC/EEPROM and clear/set some bits in the same address |
| 34 | * |
| 35 | * Revision History: |
| 36 | * 04-05-2004 Jerry Chen: Initial release |
| 37 | * 11-24-2004 Warren Hsu: Add ControlvWriteByte,ControlvReadByte,ControlvMaskByte |
| 38 | * |
| 39 | */ |
| 40 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 41 | #include "int.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 42 | #include "rxtx.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 43 | #include "dpc.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 44 | #include "control.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 45 | #include "desc.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 46 | #include "device.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 47 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 48 | //endpoint def |
| 49 | //endpoint 0: control |
| 50 | //endpoint 1: interrupt |
| 51 | //endpoint 2: read bulk |
| 52 | //endpoint 3: write bulk |
| 53 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 54 | //static int msglevel =MSG_LEVEL_DEBUG; |
| 55 | static int msglevel =MSG_LEVEL_INFO; |
| 56 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 57 | #define USB_CTL_WAIT 500 //ms |
| 58 | |
| 59 | #ifndef URB_ASYNC_UNLINK |
| 60 | #define URB_ASYNC_UNLINK 0 |
| 61 | #endif |
| 62 | |
Malcolm Priestley | fe5d00e | 2012-12-10 22:14:36 +0000 | [diff] [blame] | 63 | static void s_nsInterruptUsbIoCompleteRead(struct urb *urb); |
| 64 | static void s_nsBulkInUsbIoCompleteRead(struct urb *urb); |
| 65 | static void s_nsBulkOutIoCompleteWrite(struct urb *urb); |
| 66 | static void s_nsControlInUsbIoCompleteRead(struct urb *urb); |
| 67 | static void s_nsControlInUsbIoCompleteWrite(struct urb *urb); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 68 | |
Malcolm Priestley | fe5d00e | 2012-12-10 22:14:36 +0000 | [diff] [blame] | 69 | int PIPEnsControlOutAsyn(struct vnt_private *pDevice, u8 byRequest, |
| 70 | u16 wValue, u16 wIndex, u16 wLength, u8 *pbyBuffer) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 71 | { |
Andres More | 6487c49 | 2010-08-02 20:51:57 -0300 | [diff] [blame] | 72 | int ntStatus; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 73 | |
Andres More | 731047f | 2010-08-05 22:17:20 -0300 | [diff] [blame] | 74 | if (pDevice->Flags & fMP_DISCONNECTED) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 75 | return STATUS_FAILURE; |
| 76 | |
Andres More | 731047f | 2010-08-05 22:17:20 -0300 | [diff] [blame] | 77 | if (pDevice->Flags & fMP_CONTROL_WRITES) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 78 | return STATUS_FAILURE; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 79 | |
| 80 | if (in_interrupt()) { |
| 81 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"in_interrupt return ..byRequest %x\n", byRequest); |
| 82 | return STATUS_FAILURE; |
| 83 | } |
| 84 | |
| 85 | ntStatus = usb_control_msg( |
| 86 | pDevice->usb, |
| 87 | usb_sndctrlpipe(pDevice->usb , 0), |
| 88 | byRequest, |
| 89 | 0x40, // RequestType |
| 90 | wValue, |
| 91 | wIndex, |
Andres More | 8611a29 | 2010-05-01 14:25:00 -0300 | [diff] [blame] | 92 | (void *) pbyBuffer, |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 93 | wLength, |
| 94 | HZ |
| 95 | ); |
| 96 | if (ntStatus >= 0) { |
| 97 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"usb_sndctrlpipe ntStatus= %d\n", ntStatus); |
| 98 | ntStatus = 0; |
| 99 | } else { |
| 100 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"usb_sndctrlpipe fail, ntStatus= %d\n", ntStatus); |
| 101 | } |
| 102 | |
| 103 | return ntStatus; |
| 104 | } |
| 105 | |
Malcolm Priestley | fe5d00e | 2012-12-10 22:14:36 +0000 | [diff] [blame] | 106 | int PIPEnsControlOut(struct vnt_private *pDevice, u8 byRequest, u16 wValue, |
| 107 | u16 wIndex, u16 wLength, u8 *pbyBuffer) |
Iulia Manda | 9009dd1 | 2014-03-13 01:35:40 +0200 | [diff] [blame^] | 108 | __releases(&pDevice->lock) |
| 109 | __acquires(&pDevice->lock) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 110 | { |
Andres More | 6487c49 | 2010-08-02 20:51:57 -0300 | [diff] [blame] | 111 | int ntStatus = 0; |
Malcolm Priestley | fe5d00e | 2012-12-10 22:14:36 +0000 | [diff] [blame] | 112 | int ii; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 113 | |
Andres More | 731047f | 2010-08-05 22:17:20 -0300 | [diff] [blame] | 114 | if (pDevice->Flags & fMP_DISCONNECTED) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 115 | return STATUS_FAILURE; |
| 116 | |
Andres More | 731047f | 2010-08-05 22:17:20 -0300 | [diff] [blame] | 117 | if (pDevice->Flags & fMP_CONTROL_WRITES) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 118 | return STATUS_FAILURE; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 119 | |
Malcolm Priestley | ae5943d | 2013-01-30 20:07:29 +0000 | [diff] [blame] | 120 | if (pDevice->Flags & fMP_CONTROL_READS) |
| 121 | return STATUS_FAILURE; |
| 122 | |
Malcolm Priestley | e1feda1 | 2013-10-14 19:44:13 +0100 | [diff] [blame] | 123 | if (pDevice->pControlURB->hcpriv) |
| 124 | return STATUS_FAILURE; |
| 125 | |
Malcolm Priestley | ae5943d | 2013-01-30 20:07:29 +0000 | [diff] [blame] | 126 | MP_SET_FLAG(pDevice, fMP_CONTROL_WRITES); |
| 127 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 128 | pDevice->sUsbCtlRequest.bRequestType = 0x40; |
| 129 | pDevice->sUsbCtlRequest.bRequest = byRequest; |
| 130 | pDevice->sUsbCtlRequest.wValue = cpu_to_le16p(&wValue); |
| 131 | pDevice->sUsbCtlRequest.wIndex = cpu_to_le16p(&wIndex); |
| 132 | pDevice->sUsbCtlRequest.wLength = cpu_to_le16p(&wLength); |
| 133 | pDevice->pControlURB->transfer_flags |= URB_ASYNC_UNLINK; |
| 134 | pDevice->pControlURB->actual_length = 0; |
| 135 | // Notice, pbyBuffer limited point to variable buffer, can't be constant. |
| 136 | usb_fill_control_urb(pDevice->pControlURB, pDevice->usb, |
| 137 | usb_sndctrlpipe(pDevice->usb , 0), (char *) &pDevice->sUsbCtlRequest, |
| 138 | pbyBuffer, wLength, s_nsControlInUsbIoCompleteWrite, pDevice); |
| 139 | |
Joe Perches | bfbfeec | 2010-03-24 22:17:06 -0700 | [diff] [blame] | 140 | ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC); |
| 141 | if (ntStatus != 0) { |
Malcolm Priestley | ae5943d | 2013-01-30 20:07:29 +0000 | [diff] [blame] | 142 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
| 143 | "control send request submission failed: %d\n", |
| 144 | ntStatus); |
| 145 | MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 146 | return STATUS_FAILURE; |
| 147 | } |
Malcolm Priestley | ae5943d | 2013-01-30 20:07:29 +0000 | [diff] [blame] | 148 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 149 | spin_unlock_irq(&pDevice->lock); |
| 150 | for (ii = 0; ii <= USB_CTL_WAIT; ii ++) { |
Andres More | 731047f | 2010-08-05 22:17:20 -0300 | [diff] [blame] | 151 | |
| 152 | if (pDevice->Flags & fMP_CONTROL_WRITES) |
| 153 | mdelay(1); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 154 | else |
Andres More | 731047f | 2010-08-05 22:17:20 -0300 | [diff] [blame] | 155 | break; |
| 156 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 157 | if (ii >= USB_CTL_WAIT) { |
Andres More | 731047f | 2010-08-05 22:17:20 -0300 | [diff] [blame] | 158 | DBG_PRT(MSG_LEVEL_DEBUG, |
| 159 | KERN_INFO "control send request submission timeout\n"); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 160 | spin_lock_irq(&pDevice->lock); |
| 161 | MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES); |
| 162 | return STATUS_FAILURE; |
| 163 | } |
| 164 | } |
| 165 | spin_lock_irq(&pDevice->lock); |
| 166 | |
| 167 | return STATUS_SUCCESS; |
| 168 | } |
| 169 | |
Malcolm Priestley | fe5d00e | 2012-12-10 22:14:36 +0000 | [diff] [blame] | 170 | int PIPEnsControlIn(struct vnt_private *pDevice, u8 byRequest, u16 wValue, |
| 171 | u16 wIndex, u16 wLength, u8 *pbyBuffer) |
Iulia Manda | 9009dd1 | 2014-03-13 01:35:40 +0200 | [diff] [blame^] | 172 | __releases(&pDevice->lock) |
| 173 | __acquires(&pDevice->lock) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 174 | { |
Andres More | 6487c49 | 2010-08-02 20:51:57 -0300 | [diff] [blame] | 175 | int ntStatus = 0; |
Malcolm Priestley | fe5d00e | 2012-12-10 22:14:36 +0000 | [diff] [blame] | 176 | int ii; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 177 | |
Andres More | 731047f | 2010-08-05 22:17:20 -0300 | [diff] [blame] | 178 | if (pDevice->Flags & fMP_DISCONNECTED) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 179 | return STATUS_FAILURE; |
| 180 | |
Andres More | 731047f | 2010-08-05 22:17:20 -0300 | [diff] [blame] | 181 | if (pDevice->Flags & fMP_CONTROL_READS) |
| 182 | return STATUS_FAILURE; |
| 183 | |
Malcolm Priestley | ae5943d | 2013-01-30 20:07:29 +0000 | [diff] [blame] | 184 | if (pDevice->Flags & fMP_CONTROL_WRITES) |
| 185 | return STATUS_FAILURE; |
| 186 | |
Malcolm Priestley | e1feda1 | 2013-10-14 19:44:13 +0100 | [diff] [blame] | 187 | if (pDevice->pControlURB->hcpriv) |
| 188 | return STATUS_FAILURE; |
| 189 | |
Malcolm Priestley | ae5943d | 2013-01-30 20:07:29 +0000 | [diff] [blame] | 190 | MP_SET_FLAG(pDevice, fMP_CONTROL_READS); |
| 191 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 192 | pDevice->sUsbCtlRequest.bRequestType = 0xC0; |
| 193 | pDevice->sUsbCtlRequest.bRequest = byRequest; |
| 194 | pDevice->sUsbCtlRequest.wValue = cpu_to_le16p(&wValue); |
| 195 | pDevice->sUsbCtlRequest.wIndex = cpu_to_le16p(&wIndex); |
| 196 | pDevice->sUsbCtlRequest.wLength = cpu_to_le16p(&wLength); |
| 197 | pDevice->pControlURB->transfer_flags |= URB_ASYNC_UNLINK; |
| 198 | pDevice->pControlURB->actual_length = 0; |
| 199 | usb_fill_control_urb(pDevice->pControlURB, pDevice->usb, |
| 200 | usb_rcvctrlpipe(pDevice->usb , 0), (char *) &pDevice->sUsbCtlRequest, |
| 201 | pbyBuffer, wLength, s_nsControlInUsbIoCompleteRead, pDevice); |
| 202 | |
Joe Perches | bfbfeec | 2010-03-24 22:17:06 -0700 | [diff] [blame] | 203 | ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC); |
| 204 | if (ntStatus != 0) { |
Malcolm Priestley | ae5943d | 2013-01-30 20:07:29 +0000 | [diff] [blame] | 205 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
| 206 | "control request submission failed: %d\n", ntStatus); |
| 207 | MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS); |
| 208 | return STATUS_FAILURE; |
| 209 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 210 | |
| 211 | spin_unlock_irq(&pDevice->lock); |
| 212 | for (ii = 0; ii <= USB_CTL_WAIT; ii ++) { |
Andres More | 731047f | 2010-08-05 22:17:20 -0300 | [diff] [blame] | 213 | |
| 214 | if (pDevice->Flags & fMP_CONTROL_READS) |
| 215 | mdelay(1); |
| 216 | else |
| 217 | break; |
| 218 | |
| 219 | if (ii >= USB_CTL_WAIT) { |
| 220 | DBG_PRT(MSG_LEVEL_DEBUG, |
| 221 | KERN_INFO "control rcv request submission timeout\n"); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 222 | spin_lock_irq(&pDevice->lock); |
| 223 | MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS); |
| 224 | return STATUS_FAILURE; |
| 225 | } |
| 226 | } |
| 227 | spin_lock_irq(&pDevice->lock); |
| 228 | |
| 229 | return ntStatus; |
| 230 | } |
| 231 | |
Malcolm Priestley | fe5d00e | 2012-12-10 22:14:36 +0000 | [diff] [blame] | 232 | static void s_nsControlInUsbIoCompleteWrite(struct urb *urb) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 233 | { |
Malcolm Priestley | fe5d00e | 2012-12-10 22:14:36 +0000 | [diff] [blame] | 234 | struct vnt_private *pDevice = (struct vnt_private *)urb->context; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 235 | |
| 236 | pDevice = urb->context; |
| 237 | switch (urb->status) { |
| 238 | case 0: |
| 239 | break; |
| 240 | case -EINPROGRESS: |
| 241 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl write urb status EINPROGRESS%d\n", urb->status); |
| 242 | break; |
| 243 | case -ENOENT: |
| 244 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl write urb status ENOENT %d\n", urb->status); |
| 245 | break; |
| 246 | default: |
| 247 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl write urb status %d\n", urb->status); |
| 248 | } |
| 249 | |
| 250 | MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES); |
| 251 | } |
| 252 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 253 | /* |
| 254 | * Description: |
| 255 | * Complete function of usb Control callback |
| 256 | * |
| 257 | * Parameters: |
| 258 | * In: |
| 259 | * pDevice - Pointer to the adapter |
| 260 | * |
| 261 | * Out: |
| 262 | * none |
| 263 | * |
| 264 | * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver |
| 265 | * |
| 266 | */ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 267 | |
Malcolm Priestley | fe5d00e | 2012-12-10 22:14:36 +0000 | [diff] [blame] | 268 | static void s_nsControlInUsbIoCompleteRead(struct urb *urb) |
| 269 | { |
| 270 | struct vnt_private *pDevice = (struct vnt_private *)urb->context; |
| 271 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 272 | switch (urb->status) { |
| 273 | case 0: |
| 274 | break; |
| 275 | case -EINPROGRESS: |
| 276 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl read urb status EINPROGRESS%d\n", urb->status); |
| 277 | break; |
| 278 | case -ENOENT: |
| 279 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl read urb status = ENOENT %d\n", urb->status); |
| 280 | break; |
| 281 | default: |
| 282 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl read urb status %d\n", urb->status); |
| 283 | } |
| 284 | |
| 285 | MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS); |
| 286 | } |
| 287 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 288 | /* |
| 289 | * Description: |
| 290 | * Allocates an usb interrupt in irp and calls USBD. |
| 291 | * |
| 292 | * Parameters: |
| 293 | * In: |
| 294 | * pDevice - Pointer to the adapter |
| 295 | * Out: |
| 296 | * none |
| 297 | * |
| 298 | * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver |
| 299 | * |
| 300 | */ |
Malcolm Priestley | fe5d00e | 2012-12-10 22:14:36 +0000 | [diff] [blame] | 301 | |
Malcolm Priestley | 5f38b78 | 2014-02-19 18:37:32 +0000 | [diff] [blame] | 302 | int PIPEnsInterruptRead(struct vnt_private *priv) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 303 | { |
Malcolm Priestley | 5f38b78 | 2014-02-19 18:37:32 +0000 | [diff] [blame] | 304 | int status = STATUS_FAILURE; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 305 | |
Malcolm Priestley | 5f38b78 | 2014-02-19 18:37:32 +0000 | [diff] [blame] | 306 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
| 307 | "---->s_nsStartInterruptUsbRead()\n"); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 308 | |
Malcolm Priestley | f764e00 | 2014-02-19 18:39:09 +0000 | [diff] [blame] | 309 | if (priv->int_buf.in_use == true) |
Malcolm Priestley | 5f38b78 | 2014-02-19 18:37:32 +0000 | [diff] [blame] | 310 | return STATUS_FAILURE; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 311 | |
Malcolm Priestley | f764e00 | 2014-02-19 18:39:09 +0000 | [diff] [blame] | 312 | priv->int_buf.in_use = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 313 | |
Malcolm Priestley | 5f38b78 | 2014-02-19 18:37:32 +0000 | [diff] [blame] | 314 | usb_fill_int_urb(priv->pInterruptURB, |
| 315 | priv->usb, |
| 316 | usb_rcvbulkpipe(priv->usb, 1), |
Malcolm Priestley | f764e00 | 2014-02-19 18:39:09 +0000 | [diff] [blame] | 317 | priv->int_buf.data_buf, |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 318 | MAX_INTERRUPT_SIZE, |
| 319 | s_nsInterruptUsbIoCompleteRead, |
Malcolm Priestley | 5f38b78 | 2014-02-19 18:37:32 +0000 | [diff] [blame] | 320 | priv, |
| 321 | priv->int_interval); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 322 | |
Malcolm Priestley | 5f38b78 | 2014-02-19 18:37:32 +0000 | [diff] [blame] | 323 | status = usb_submit_urb(priv->pInterruptURB, GFP_ATOMIC); |
| 324 | if (status) { |
Malcolm Priestley | 59858f5 | 2014-02-19 18:36:37 +0000 | [diff] [blame] | 325 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
Malcolm Priestley | 5f38b78 | 2014-02-19 18:37:32 +0000 | [diff] [blame] | 326 | "Submit int URB failed %d\n", status); |
Malcolm Priestley | f764e00 | 2014-02-19 18:39:09 +0000 | [diff] [blame] | 327 | priv->int_buf.in_use = false; |
Malcolm Priestley | 59858f5 | 2014-02-19 18:36:37 +0000 | [diff] [blame] | 328 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 329 | |
Malcolm Priestley | 5f38b78 | 2014-02-19 18:37:32 +0000 | [diff] [blame] | 330 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
| 331 | "<----s_nsStartInterruptUsbRead Return(%x)\n", status); |
| 332 | |
| 333 | return status; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 334 | } |
| 335 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 336 | /* |
| 337 | * Description: |
| 338 | * Complete function of usb interrupt in irp. |
| 339 | * |
| 340 | * Parameters: |
| 341 | * In: |
| 342 | * pDevice - Pointer to the adapter |
| 343 | * |
| 344 | * Out: |
| 345 | * none |
| 346 | * |
| 347 | * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver |
| 348 | * |
| 349 | */ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 350 | |
Malcolm Priestley | fe5d00e | 2012-12-10 22:14:36 +0000 | [diff] [blame] | 351 | static void s_nsInterruptUsbIoCompleteRead(struct urb *urb) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 352 | { |
Malcolm Priestley | 599e4b5 | 2014-02-25 20:51:51 +0000 | [diff] [blame] | 353 | struct vnt_private *priv = urb->context; |
Malcolm Priestley | d9ad7a9 | 2014-02-17 21:27:30 +0000 | [diff] [blame] | 354 | int status; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 355 | |
Malcolm Priestley | d9ad7a9 | 2014-02-17 21:27:30 +0000 | [diff] [blame] | 356 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
| 357 | "---->s_nsInterruptUsbIoCompleteRead\n"); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 358 | |
Malcolm Priestley | c98fbf9 | 2014-02-17 21:16:20 +0000 | [diff] [blame] | 359 | switch (urb->status) { |
| 360 | case 0: |
| 361 | case -ETIMEDOUT: |
| 362 | break; |
| 363 | case -ECONNRESET: |
| 364 | case -ENOENT: |
| 365 | case -ESHUTDOWN: |
Malcolm Priestley | f764e00 | 2014-02-19 18:39:09 +0000 | [diff] [blame] | 366 | priv->int_buf.in_use = false; |
Malcolm Priestley | c98fbf9 | 2014-02-17 21:16:20 +0000 | [diff] [blame] | 367 | return; |
| 368 | default: |
| 369 | break; |
| 370 | } |
| 371 | |
Malcolm Priestley | d9ad7a9 | 2014-02-17 21:27:30 +0000 | [diff] [blame] | 372 | status = urb->status; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 373 | |
Malcolm Priestley | d9ad7a9 | 2014-02-17 21:27:30 +0000 | [diff] [blame] | 374 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
| 375 | "s_nsInterruptUsbIoCompleteRead Status %d\n", status); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 376 | |
Malcolm Priestley | d9ad7a9 | 2014-02-17 21:27:30 +0000 | [diff] [blame] | 377 | if (status != STATUS_SUCCESS) { |
Malcolm Priestley | f764e00 | 2014-02-19 18:39:09 +0000 | [diff] [blame] | 378 | priv->int_buf.in_use = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 379 | |
Malcolm Priestley | 247b4b6 | 2014-02-17 21:12:51 +0000 | [diff] [blame] | 380 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
Malcolm Priestley | d9ad7a9 | 2014-02-17 21:27:30 +0000 | [diff] [blame] | 381 | "IntUSBIoCompleteControl STATUS = %d\n", status); |
Malcolm Priestley | 247b4b6 | 2014-02-17 21:12:51 +0000 | [diff] [blame] | 382 | } else { |
Malcolm Priestley | d9ad7a9 | 2014-02-17 21:27:30 +0000 | [diff] [blame] | 383 | INTnsProcessData(priv); |
Malcolm Priestley | 247b4b6 | 2014-02-17 21:12:51 +0000 | [diff] [blame] | 384 | } |
Malcolm Priestley | 749627f | 2014-02-17 21:24:33 +0000 | [diff] [blame] | 385 | |
Malcolm Priestley | d9ad7a9 | 2014-02-17 21:27:30 +0000 | [diff] [blame] | 386 | status = usb_submit_urb(priv->pInterruptURB, GFP_ATOMIC); |
| 387 | if (status) { |
| 388 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
| 389 | "Submit int URB failed %d\n", status); |
| 390 | } else { |
Malcolm Priestley | f764e00 | 2014-02-19 18:39:09 +0000 | [diff] [blame] | 391 | priv->int_buf.in_use = true; |
Malcolm Priestley | d9ad7a9 | 2014-02-17 21:27:30 +0000 | [diff] [blame] | 392 | } |
| 393 | |
| 394 | return; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 395 | } |
| 396 | |
| 397 | /* |
| 398 | * Description: |
| 399 | * Allocates an usb BulkIn irp and calls USBD. |
| 400 | * |
| 401 | * Parameters: |
| 402 | * In: |
| 403 | * pDevice - Pointer to the adapter |
| 404 | * Out: |
| 405 | * none |
| 406 | * |
| 407 | * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver |
| 408 | * |
| 409 | */ |
Malcolm Priestley | fe5d00e | 2012-12-10 22:14:36 +0000 | [diff] [blame] | 410 | |
Malcolm Priestley | 0b787d7 | 2014-02-25 20:51:50 +0000 | [diff] [blame] | 411 | int PIPEnsBulkInUsbRead(struct vnt_private *priv, struct vnt_rcb *rcb) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 412 | { |
Malcolm Priestley | 0b787d7 | 2014-02-25 20:51:50 +0000 | [diff] [blame] | 413 | int status = 0; |
| 414 | struct urb *urb; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 415 | |
Malcolm Priestley | 0b787d7 | 2014-02-25 20:51:50 +0000 | [diff] [blame] | 416 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsStartBulkInUsbRead\n"); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 417 | |
Malcolm Priestley | 0b787d7 | 2014-02-25 20:51:50 +0000 | [diff] [blame] | 418 | if (priv->Flags & fMP_DISCONNECTED) |
| 419 | return STATUS_FAILURE; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 420 | |
Malcolm Priestley | 0b787d7 | 2014-02-25 20:51:50 +0000 | [diff] [blame] | 421 | urb = rcb->pUrb; |
| 422 | if (rcb->skb == NULL) { |
| 423 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"rcb->skb is null\n"); |
| 424 | return status; |
| 425 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 426 | |
Malcolm Priestley | 0b787d7 | 2014-02-25 20:51:50 +0000 | [diff] [blame] | 427 | usb_fill_bulk_urb(urb, |
| 428 | priv->usb, |
| 429 | usb_rcvbulkpipe(priv->usb, 2), |
| 430 | (void *) (rcb->skb->data), |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 431 | MAX_TOTAL_SIZE_WITH_ALL_HEADERS, |
| 432 | s_nsBulkInUsbIoCompleteRead, |
Malcolm Priestley | 0b787d7 | 2014-02-25 20:51:50 +0000 | [diff] [blame] | 433 | rcb); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 434 | |
Malcolm Priestley | 0b787d7 | 2014-02-25 20:51:50 +0000 | [diff] [blame] | 435 | status = usb_submit_urb(urb, GFP_ATOMIC); |
| 436 | if (status != 0) { |
| 437 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
| 438 | "Submit Rx URB failed %d\n", status); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 439 | return STATUS_FAILURE ; |
| 440 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 441 | |
Malcolm Priestley | 0b787d7 | 2014-02-25 20:51:50 +0000 | [diff] [blame] | 442 | rcb->Ref = 1; |
| 443 | rcb->bBoolInUse = true; |
| 444 | |
| 445 | return status; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 446 | } |
| 447 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 448 | /* |
| 449 | * Description: |
| 450 | * Complete function of usb BulkIn irp. |
| 451 | * |
| 452 | * Parameters: |
| 453 | * In: |
| 454 | * pDevice - Pointer to the adapter |
| 455 | * |
| 456 | * Out: |
| 457 | * none |
| 458 | * |
| 459 | * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver |
| 460 | * |
| 461 | */ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 462 | |
Malcolm Priestley | fe5d00e | 2012-12-10 22:14:36 +0000 | [diff] [blame] | 463 | static void s_nsBulkInUsbIoCompleteRead(struct urb *urb) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 464 | { |
Malcolm Priestley | 599e4b5 | 2014-02-25 20:51:51 +0000 | [diff] [blame] | 465 | struct vnt_rcb *rcb = urb->context; |
Malcolm Priestley | d4fa2ab | 2014-02-25 20:51:49 +0000 | [diff] [blame] | 466 | struct vnt_private *priv = rcb->pDevice; |
| 467 | int re_alloc_skb = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 468 | |
Malcolm Priestley | d4fa2ab | 2014-02-25 20:51:49 +0000 | [diff] [blame] | 469 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkInUsbIoCompleteRead\n"); |
Malcolm Priestley | e3a8fa1 | 2014-02-25 20:51:46 +0000 | [diff] [blame] | 470 | |
Malcolm Priestley | 6763898 | 2014-02-25 20:51:48 +0000 | [diff] [blame] | 471 | switch (urb->status) { |
| 472 | case 0: |
Malcolm Priestley | 6763898 | 2014-02-25 20:51:48 +0000 | [diff] [blame] | 473 | break; |
| 474 | case -ECONNRESET: |
| 475 | case -ENOENT: |
| 476 | case -ESHUTDOWN: |
| 477 | return; |
| 478 | case -ETIMEDOUT: |
| 479 | default: |
Malcolm Priestley | 6763898 | 2014-02-25 20:51:48 +0000 | [diff] [blame] | 480 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
| 481 | "BULK In failed %d\n", urb->status); |
| 482 | break; |
| 483 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 484 | |
Malcolm Priestley | d4fa2ab | 2014-02-25 20:51:49 +0000 | [diff] [blame] | 485 | if (urb->actual_length) { |
| 486 | spin_lock(&priv->lock); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 487 | |
Malcolm Priestley | d4fa2ab | 2014-02-25 20:51:49 +0000 | [diff] [blame] | 488 | if (RXbBulkInProcessData(priv, rcb, urb->actual_length) == true) |
| 489 | re_alloc_skb = true; |
| 490 | |
| 491 | spin_unlock(&priv->lock); |
| 492 | } |
| 493 | |
| 494 | rcb->Ref--; |
| 495 | if (rcb->Ref == 0) { |
| 496 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RxvFreeNormal %d\n", |
| 497 | priv->NumRecvFreeList); |
| 498 | spin_lock(&priv->lock); |
| 499 | |
| 500 | RXvFreeRCB(rcb, re_alloc_skb); |
| 501 | |
| 502 | spin_unlock(&priv->lock); |
| 503 | } |
| 504 | |
| 505 | return; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 506 | } |
| 507 | |
| 508 | /* |
| 509 | * Description: |
| 510 | * Allocates an usb BulkOut irp and calls USBD. |
| 511 | * |
| 512 | * Parameters: |
| 513 | * In: |
| 514 | * pDevice - Pointer to the adapter |
| 515 | * Out: |
| 516 | * none |
| 517 | * |
| 518 | * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver |
| 519 | * |
| 520 | */ |
Malcolm Priestley | fe5d00e | 2012-12-10 22:14:36 +0000 | [diff] [blame] | 521 | |
Malcolm Priestley | 3f38290 | 2014-02-25 20:51:45 +0000 | [diff] [blame] | 522 | int PIPEnsSendBulkOut(struct vnt_private *priv, |
| 523 | struct vnt_usb_send_context *context) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 524 | { |
Malcolm Priestley | fe5d00e | 2012-12-10 22:14:36 +0000 | [diff] [blame] | 525 | int status; |
Malcolm Priestley | 3f38290 | 2014-02-25 20:51:45 +0000 | [diff] [blame] | 526 | struct urb *urb; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 527 | |
Malcolm Priestley | 3f38290 | 2014-02-25 20:51:45 +0000 | [diff] [blame] | 528 | priv->bPWBitOn = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 529 | |
Malcolm Priestley | 3f38290 | 2014-02-25 20:51:45 +0000 | [diff] [blame] | 530 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_nsSendBulkOut\n"); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 531 | |
Malcolm Priestley | 3f38290 | 2014-02-25 20:51:45 +0000 | [diff] [blame] | 532 | if (!(MP_IS_READY(priv) && priv->Flags & fMP_POST_WRITES)) { |
| 533 | context->bBoolInUse = false; |
Malcolm Priestley | 1333830 | 2014-02-25 20:51:43 +0000 | [diff] [blame] | 534 | return STATUS_RESOURCES; |
| 535 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 536 | |
Malcolm Priestley | 3f38290 | 2014-02-25 20:51:45 +0000 | [diff] [blame] | 537 | urb = context->pUrb; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 538 | |
Malcolm Priestley | 3f38290 | 2014-02-25 20:51:45 +0000 | [diff] [blame] | 539 | usb_fill_bulk_urb(urb, |
| 540 | priv->usb, |
| 541 | usb_sndbulkpipe(priv->usb, 3), |
| 542 | context->Data, |
| 543 | context->uBufLen, |
| 544 | s_nsBulkOutIoCompleteWrite, |
| 545 | context); |
| 546 | |
| 547 | status = usb_submit_urb(urb, GFP_ATOMIC); |
| 548 | if (status != 0) { |
| 549 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
| 550 | "Submit Tx URB failed %d\n", status); |
| 551 | context->bBoolInUse = false; |
| 552 | return STATUS_FAILURE; |
| 553 | } |
| 554 | |
| 555 | return STATUS_PENDING; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 556 | } |
| 557 | |
| 558 | /* |
| 559 | * Description: s_nsBulkOutIoCompleteWrite |
| 560 | * 1a) Indicate to the protocol the status of the write. |
| 561 | * 1b) Return ownership of the packet to the protocol. |
| 562 | * |
| 563 | * 2) If any more packets are queue for sending, send another packet |
| 564 | * to USBD. |
| 565 | * If the attempt to send the packet to the driver fails, |
| 566 | * return ownership of the packet to the protocol and |
| 567 | * try another packet (until one succeeds). |
| 568 | * |
| 569 | * Parameters: |
| 570 | * In: |
| 571 | * pdoUsbDevObj - pointer to the USB device object which |
| 572 | * completed the irp |
| 573 | * pIrp - the irp which was completed by the |
| 574 | * device object |
| 575 | * pContext - the context given to IoSetCompletionRoutine |
| 576 | * before calling IoCallDriver on the irp |
| 577 | * The pContext is a pointer to the USB device object. |
| 578 | * Out: |
| 579 | * none |
| 580 | * |
| 581 | * Return Value: STATUS_MORE_PROCESSING_REQUIRED - allows the completion routine |
| 582 | * (IofCompleteRequest) to stop working on the irp. |
| 583 | * |
| 584 | */ |
Malcolm Priestley | fe5d00e | 2012-12-10 22:14:36 +0000 | [diff] [blame] | 585 | |
| 586 | static void s_nsBulkOutIoCompleteWrite(struct urb *urb) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 587 | { |
Malcolm Priestley | 599e4b5 | 2014-02-25 20:51:51 +0000 | [diff] [blame] | 588 | struct vnt_usb_send_context *context = urb->context; |
Malcolm Priestley | 21aa212 | 2014-02-19 21:54:45 +0000 | [diff] [blame] | 589 | struct vnt_private *priv = context->pDevice; |
Malcolm Priestley | 1450ba6 | 2014-02-19 21:56:33 +0000 | [diff] [blame] | 590 | u8 context_type = context->type; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 591 | |
Malcolm Priestley | 21aa212 | 2014-02-19 21:54:45 +0000 | [diff] [blame] | 592 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkOutIoCompleteWrite\n"); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 593 | |
Malcolm Priestley | e8152bf | 2014-02-19 21:53:35 +0000 | [diff] [blame] | 594 | switch (urb->status) { |
| 595 | case 0: |
Malcolm Priestley | d1b2a11 | 2014-02-27 23:06:15 +0000 | [diff] [blame] | 596 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
| 597 | "Write %d bytes\n", context->uBufLen); |
Malcolm Priestley | e8152bf | 2014-02-19 21:53:35 +0000 | [diff] [blame] | 598 | break; |
| 599 | case -ECONNRESET: |
| 600 | case -ENOENT: |
| 601 | case -ESHUTDOWN: |
Malcolm Priestley | 21aa212 | 2014-02-19 21:54:45 +0000 | [diff] [blame] | 602 | context->bBoolInUse = false; |
Malcolm Priestley | e8152bf | 2014-02-19 21:53:35 +0000 | [diff] [blame] | 603 | return; |
Malcolm Priestley | d1b2a11 | 2014-02-27 23:06:15 +0000 | [diff] [blame] | 604 | case -ETIMEDOUT: |
Malcolm Priestley | e8152bf | 2014-02-19 21:53:35 +0000 | [diff] [blame] | 605 | default: |
Malcolm Priestley | d1b2a11 | 2014-02-27 23:06:15 +0000 | [diff] [blame] | 606 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
| 607 | "BULK Out failed %d\n", urb->status); |
Malcolm Priestley | e8152bf | 2014-02-19 21:53:35 +0000 | [diff] [blame] | 608 | break; |
| 609 | } |
| 610 | |
Malcolm Priestley | 21aa212 | 2014-02-19 21:54:45 +0000 | [diff] [blame] | 611 | if (!netif_device_present(priv->dev)) |
| 612 | return; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 613 | |
Malcolm Priestley | 21aa212 | 2014-02-19 21:54:45 +0000 | [diff] [blame] | 614 | if (CONTEXT_DATA_PACKET == context_type) { |
| 615 | if (context->pPacket != NULL) { |
| 616 | dev_kfree_skb_irq(context->pPacket); |
| 617 | context->pPacket = NULL; |
| 618 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
Malcolm Priestley | d597aae | 2014-02-27 23:06:14 +0000 | [diff] [blame] | 619 | "tx %d bytes\n", context->uBufLen); |
Malcolm Priestley | 21aa212 | 2014-02-19 21:54:45 +0000 | [diff] [blame] | 620 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 621 | |
Malcolm Priestley | 21aa212 | 2014-02-19 21:54:45 +0000 | [diff] [blame] | 622 | priv->dev->trans_start = jiffies; |
Malcolm Priestley | 21aa212 | 2014-02-19 21:54:45 +0000 | [diff] [blame] | 623 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 624 | |
Malcolm Priestley | 21aa212 | 2014-02-19 21:54:45 +0000 | [diff] [blame] | 625 | if (priv->bLinkPass == true) { |
| 626 | if (netif_queue_stopped(priv->dev)) |
| 627 | netif_wake_queue(priv->dev); |
| 628 | } |
| 629 | |
| 630 | context->bBoolInUse = false; |
| 631 | |
| 632 | return; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 633 | } |