Adding support for MOXA ART SoC. Testing port of linux-2.6.32.60-moxart.
[linux-3.6.7-moxart.git] / drivers / staging / vt6656 / usbpipe.c
blob609e8fa10b982dd5527f6b041c285cd08992867c
1 /*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
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.
20 * File: usbpipe.c
22 * Purpose: Handle USB control endpoint
24 * Author: Warren Hsu
26 * Date: Mar. 29, 2005
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
35 * Revision History:
36 * 04-05-2004 Jerry Chen: Initial release
37 * 11-24-2004 Warren Hsu: Add ControlvWriteByte,ControlvReadByte,ControlvMaskByte
41 #include "int.h"
42 #include "rxtx.h"
43 #include "dpc.h"
44 #include "control.h"
45 #include "desc.h"
46 #include "device.h"
48 /*--------------------- Static Definitions -------------------------*/
49 //endpoint def
50 //endpoint 0: control
51 //endpoint 1: interrupt
52 //endpoint 2: read bulk
53 //endpoint 3: write bulk
55 //static int msglevel =MSG_LEVEL_DEBUG;
56 static int msglevel =MSG_LEVEL_INFO;
59 #define USB_CTL_WAIT 500 //ms
61 #ifndef URB_ASYNC_UNLINK
62 #define URB_ASYNC_UNLINK 0
63 #endif
65 /*--------------------- Static Classes ----------------------------*/
67 /*--------------------- Static Variables --------------------------*/
69 /*--------------------- Static Functions --------------------------*/
70 static
71 void
72 s_nsInterruptUsbIoCompleteRead(
73 struct urb *urb
77 static
78 void
79 s_nsBulkInUsbIoCompleteRead(
80 struct urb *urb
84 static
85 void
86 s_nsBulkOutIoCompleteWrite(
87 struct urb *urb
91 static
92 void
93 s_nsControlInUsbIoCompleteRead(
94 struct urb *urb
97 static
98 void
99 s_nsControlInUsbIoCompleteWrite(
100 struct urb *urb
103 /*--------------------- Export Variables --------------------------*/
105 /*--------------------- Export Functions --------------------------*/
107 int PIPEnsControlOutAsyn(
108 PSDevice pDevice,
109 BYTE byRequest,
110 WORD wValue,
111 WORD wIndex,
112 WORD wLength,
113 PBYTE pbyBuffer
116 int ntStatus;
118 if (pDevice->Flags & fMP_DISCONNECTED)
119 return STATUS_FAILURE;
121 if (pDevice->Flags & fMP_CONTROL_WRITES)
122 return STATUS_FAILURE;
124 if (in_interrupt()) {
125 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"in_interrupt return ..byRequest %x\n", byRequest);
126 return STATUS_FAILURE;
129 ntStatus = usb_control_msg(
130 pDevice->usb,
131 usb_sndctrlpipe(pDevice->usb , 0),
132 byRequest,
133 0x40, // RequestType
134 wValue,
135 wIndex,
136 (void *) pbyBuffer,
137 wLength,
140 if (ntStatus >= 0) {
141 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"usb_sndctrlpipe ntStatus= %d\n", ntStatus);
142 ntStatus = 0;
143 } else {
144 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"usb_sndctrlpipe fail, ntStatus= %d\n", ntStatus);
147 return ntStatus;
150 int PIPEnsControlOut(
151 PSDevice pDevice,
152 BYTE byRequest,
153 WORD wValue,
154 WORD wIndex,
155 WORD wLength,
156 PBYTE pbyBuffer
159 int ntStatus = 0;
160 int ii;
162 if (pDevice->Flags & fMP_DISCONNECTED)
163 return STATUS_FAILURE;
165 if (pDevice->Flags & fMP_CONTROL_WRITES)
166 return STATUS_FAILURE;
168 pDevice->sUsbCtlRequest.bRequestType = 0x40;
169 pDevice->sUsbCtlRequest.bRequest = byRequest;
170 pDevice->sUsbCtlRequest.wValue = cpu_to_le16p(&wValue);
171 pDevice->sUsbCtlRequest.wIndex = cpu_to_le16p(&wIndex);
172 pDevice->sUsbCtlRequest.wLength = cpu_to_le16p(&wLength);
173 pDevice->pControlURB->transfer_flags |= URB_ASYNC_UNLINK;
174 pDevice->pControlURB->actual_length = 0;
175 // Notice, pbyBuffer limited point to variable buffer, can't be constant.
176 usb_fill_control_urb(pDevice->pControlURB, pDevice->usb,
177 usb_sndctrlpipe(pDevice->usb , 0), (char *) &pDevice->sUsbCtlRequest,
178 pbyBuffer, wLength, s_nsControlInUsbIoCompleteWrite, pDevice);
180 ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC);
181 if (ntStatus != 0) {
182 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"control send request submission failed: %d\n", ntStatus);
183 return STATUS_FAILURE;
185 else {
186 MP_SET_FLAG(pDevice, fMP_CONTROL_WRITES);
188 spin_unlock_irq(&pDevice->lock);
189 for (ii = 0; ii <= USB_CTL_WAIT; ii ++) {
191 if (pDevice->Flags & fMP_CONTROL_WRITES)
192 mdelay(1);
193 else
194 break;
196 if (ii >= USB_CTL_WAIT) {
197 DBG_PRT(MSG_LEVEL_DEBUG,
198 KERN_INFO "control send request submission timeout\n");
199 spin_lock_irq(&pDevice->lock);
200 MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES);
201 return STATUS_FAILURE;
204 spin_lock_irq(&pDevice->lock);
206 return STATUS_SUCCESS;
209 int PIPEnsControlIn(
210 PSDevice pDevice,
211 BYTE byRequest,
212 WORD wValue,
213 WORD wIndex,
214 WORD wLength,
215 PBYTE pbyBuffer
218 int ntStatus = 0;
219 int ii;
221 if (pDevice->Flags & fMP_DISCONNECTED)
222 return STATUS_FAILURE;
224 if (pDevice->Flags & fMP_CONTROL_READS)
225 return STATUS_FAILURE;
227 pDevice->sUsbCtlRequest.bRequestType = 0xC0;
228 pDevice->sUsbCtlRequest.bRequest = byRequest;
229 pDevice->sUsbCtlRequest.wValue = cpu_to_le16p(&wValue);
230 pDevice->sUsbCtlRequest.wIndex = cpu_to_le16p(&wIndex);
231 pDevice->sUsbCtlRequest.wLength = cpu_to_le16p(&wLength);
232 pDevice->pControlURB->transfer_flags |= URB_ASYNC_UNLINK;
233 pDevice->pControlURB->actual_length = 0;
234 usb_fill_control_urb(pDevice->pControlURB, pDevice->usb,
235 usb_rcvctrlpipe(pDevice->usb , 0), (char *) &pDevice->sUsbCtlRequest,
236 pbyBuffer, wLength, s_nsControlInUsbIoCompleteRead, pDevice);
238 ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC);
239 if (ntStatus != 0) {
240 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"control request submission failed: %d\n", ntStatus);
241 }else {
242 MP_SET_FLAG(pDevice, fMP_CONTROL_READS);
245 spin_unlock_irq(&pDevice->lock);
246 for (ii = 0; ii <= USB_CTL_WAIT; ii ++) {
248 if (pDevice->Flags & fMP_CONTROL_READS)
249 mdelay(1);
250 else
251 break;
253 if (ii >= USB_CTL_WAIT) {
254 DBG_PRT(MSG_LEVEL_DEBUG,
255 KERN_INFO "control rcv request submission timeout\n");
256 spin_lock_irq(&pDevice->lock);
257 MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS);
258 return STATUS_FAILURE;
261 spin_lock_irq(&pDevice->lock);
263 return ntStatus;
266 static
267 void
268 s_nsControlInUsbIoCompleteWrite(
269 struct urb *urb
272 PSDevice pDevice;
274 pDevice = urb->context;
275 switch (urb->status) {
276 case 0:
277 break;
278 case -EINPROGRESS:
279 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl write urb status EINPROGRESS%d\n", urb->status);
280 break;
281 case -ENOENT:
282 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl write urb status ENOENT %d\n", urb->status);
283 break;
284 default:
285 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl write urb status %d\n", urb->status);
288 MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES);
294 * Description:
295 * Complete function of usb Control callback
297 * Parameters:
298 * In:
299 * pDevice - Pointer to the adapter
301 * Out:
302 * none
304 * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver
307 static
308 void
309 s_nsControlInUsbIoCompleteRead(
310 struct urb *urb
313 PSDevice pDevice;
315 pDevice = urb->context;
316 switch (urb->status) {
317 case 0:
318 break;
319 case -EINPROGRESS:
320 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl read urb status EINPROGRESS%d\n", urb->status);
321 break;
322 case -ENOENT:
323 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl read urb status = ENOENT %d\n", urb->status);
324 break;
325 default:
326 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl read urb status %d\n", urb->status);
329 MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS);
336 * Description:
337 * Allocates an usb interrupt in irp and calls USBD.
339 * Parameters:
340 * In:
341 * pDevice - Pointer to the adapter
342 * Out:
343 * none
345 * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver
348 int PIPEnsInterruptRead(PSDevice pDevice)
350 int ntStatus = STATUS_FAILURE;
352 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsStartInterruptUsbRead()\n");
354 if(pDevice->intBuf.bInUse == TRUE){
355 return (STATUS_FAILURE);
357 pDevice->intBuf.bInUse = TRUE;
358 // pDevice->bEventAvailable = FALSE;
359 pDevice->ulIntInPosted++;
362 // Now that we have created the urb, we will send a
363 // request to the USB device object.
365 pDevice->pInterruptURB->interval = pDevice->int_interval;
367 usb_fill_bulk_urb(pDevice->pInterruptURB,
368 pDevice->usb,
369 usb_rcvbulkpipe(pDevice->usb, 1),
370 (void *) pDevice->intBuf.pDataBuf,
371 MAX_INTERRUPT_SIZE,
372 s_nsInterruptUsbIoCompleteRead,
373 pDevice);
375 ntStatus = usb_submit_urb(pDevice->pInterruptURB, GFP_ATOMIC);
376 if (ntStatus != 0) {
377 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit int URB failed %d\n", ntStatus);
380 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"<----s_nsStartInterruptUsbRead Return(%x)\n",ntStatus);
381 return ntStatus;
386 * Description:
387 * Complete function of usb interrupt in irp.
389 * Parameters:
390 * In:
391 * pDevice - Pointer to the adapter
393 * Out:
394 * none
396 * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver
399 static
400 void
401 s_nsInterruptUsbIoCompleteRead(
402 struct urb *urb
406 PSDevice pDevice;
407 int ntStatus;
409 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptUsbIoCompleteRead\n");
411 // The context given to IoSetCompletionRoutine is the receive buffer object
413 pDevice = (PSDevice)urb->context;
416 // We have a number of cases:
417 // 1) The USB read timed out and we received no data.
418 // 2) The USB read timed out and we received some data.
419 // 3) The USB read was successful and fully filled our irp buffer.
420 // 4) The irp was cancelled.
421 // 5) Some other failure from the USB device object.
423 ntStatus = urb->status;
425 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_nsInterruptUsbIoCompleteRead Status %d\n", ntStatus);
427 // if we were not successful, we need to free the int buffer for future use right here
428 // otherwise interrupt data handler will free int buffer after it handle it.
429 if (( ntStatus != STATUS_SUCCESS )) {
430 pDevice->ulBulkInError++;
431 pDevice->intBuf.bInUse = FALSE;
433 // if (ntStatus == USBD_STATUS_CRC) {
434 // pDevice->ulIntInContCRCError++;
435 // }
437 // if (ntStatus == STATUS_NOT_CONNECTED )
438 // {
439 pDevice->fKillEventPollingThread = TRUE;
440 // }
441 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"IntUSBIoCompleteControl STATUS = %d\n", ntStatus );
442 } else {
443 pDevice->ulIntInBytesRead += (unsigned long) urb->actual_length;
444 pDevice->ulIntInContCRCError = 0;
445 pDevice->bEventAvailable = TRUE;
446 INTnsProcessData(pDevice);
449 STAvUpdateUSBCounter(&pDevice->scStatistic.USB_InterruptStat, ntStatus);
452 if (pDevice->fKillEventPollingThread != TRUE) {
453 usb_fill_bulk_urb(pDevice->pInterruptURB,
454 pDevice->usb,
455 usb_rcvbulkpipe(pDevice->usb, 1),
456 (void *) pDevice->intBuf.pDataBuf,
457 MAX_INTERRUPT_SIZE,
458 s_nsInterruptUsbIoCompleteRead,
459 pDevice);
461 ntStatus = usb_submit_urb(pDevice->pInterruptURB, GFP_ATOMIC);
462 if (ntStatus != 0) {
463 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit int URB failed %d\n", ntStatus);
467 // We return STATUS_MORE_PROCESSING_REQUIRED so that the completion
468 // routine (IofCompleteRequest) will stop working on the irp.
470 return ;
474 * Description:
475 * Allocates an usb BulkIn irp and calls USBD.
477 * Parameters:
478 * In:
479 * pDevice - Pointer to the adapter
480 * Out:
481 * none
483 * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver
486 int PIPEnsBulkInUsbRead(PSDevice pDevice, PRCB pRCB)
488 int ntStatus = 0;
489 struct urb *pUrb;
492 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsStartBulkInUsbRead\n");
494 if (pDevice->Flags & fMP_DISCONNECTED)
495 return STATUS_FAILURE;
497 pDevice->ulBulkInPosted++;
500 pUrb = pRCB->pUrb;
502 // Now that we have created the urb, we will send a
503 // request to the USB device object.
505 if (pRCB->skb == NULL) {
506 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pRCB->skb is null \n");
507 return ntStatus;
510 usb_fill_bulk_urb(pUrb,
511 pDevice->usb,
512 usb_rcvbulkpipe(pDevice->usb, 2),
513 (void *) (pRCB->skb->data),
514 MAX_TOTAL_SIZE_WITH_ALL_HEADERS,
515 s_nsBulkInUsbIoCompleteRead,
516 pRCB);
518 ntStatus = usb_submit_urb(pUrb, GFP_ATOMIC);
519 if (ntStatus != 0) {
520 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit Rx URB failed %d\n", ntStatus);
521 return STATUS_FAILURE ;
523 pRCB->Ref = 1;
524 pRCB->bBoolInUse= TRUE;
526 return ntStatus;
533 * Description:
534 * Complete function of usb BulkIn irp.
536 * Parameters:
537 * In:
538 * pDevice - Pointer to the adapter
540 * Out:
541 * none
543 * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver
546 static
547 void
548 s_nsBulkInUsbIoCompleteRead(
549 struct urb *urb
553 PRCB pRCB = (PRCB)urb->context;
554 PSDevice pDevice = (PSDevice)pRCB->pDevice;
555 unsigned long bytesRead;
556 BOOL bIndicateReceive = FALSE;
557 BOOL bReAllocSkb = FALSE;
558 int status;
560 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkInUsbIoCompleteRead\n");
561 status = urb->status;
562 bytesRead = urb->actual_length;
564 if (status) {
565 pDevice->ulBulkInError++;
566 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BULK In failed %d\n", status);
568 pDevice->scStatistic.RxFcsErrCnt ++;
569 //todo...xxxxxx
570 // if (status == USBD_STATUS_CRC) {
571 // pDevice->ulBulkInContCRCError++;
572 // }
573 // if (status == STATUS_DEVICE_NOT_CONNECTED )
574 // {
575 // MP_SET_FLAG(pDevice, fMP_DISCONNECTED);
576 // }
577 } else {
578 bIndicateReceive = TRUE;
579 pDevice->ulBulkInContCRCError = 0;
580 pDevice->ulBulkInBytesRead += bytesRead;
582 pDevice->scStatistic.RxOkCnt ++;
586 STAvUpdateUSBCounter(&pDevice->scStatistic.USB_BulkInStat, status);
588 if (bIndicateReceive) {
589 spin_lock(&pDevice->lock);
590 if (RXbBulkInProcessData(pDevice, pRCB, bytesRead) == TRUE)
591 bReAllocSkb = TRUE;
592 spin_unlock(&pDevice->lock);
594 pRCB->Ref--;
595 if (pRCB->Ref == 0)
597 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RxvFreeNormal %d \n",pDevice->NumRecvFreeList);
598 spin_lock(&pDevice->lock);
599 RXvFreeRCB(pRCB, bReAllocSkb);
600 spin_unlock(&pDevice->lock);
604 return;
608 * Description:
609 * Allocates an usb BulkOut irp and calls USBD.
611 * Parameters:
612 * In:
613 * pDevice - Pointer to the adapter
614 * Out:
615 * none
617 * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver
621 PIPEnsSendBulkOut(
622 PSDevice pDevice,
623 PUSB_SEND_CONTEXT pContext
626 int status;
627 struct urb *pUrb;
631 pDevice->bPWBitOn = FALSE;
634 if (pDevice->pPendingBulkOutContext != NULL) {
635 pDevice->NumContextsQueued++;
636 EnqueueContext(pDevice->FirstTxContextQueue, pDevice->LastTxContextQueue, pContext);
637 status = STATUS_PENDING;
638 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Send pending!\n");
639 return status;
643 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_nsSendBulkOut\n");
645 if (MP_IS_READY(pDevice) && (pDevice->Flags & fMP_POST_WRITES)) {
647 pUrb = pContext->pUrb;
648 pDevice->ulBulkOutPosted++;
649 // pDevice->pPendingBulkOutContext = pContext;
650 usb_fill_bulk_urb(
651 pUrb,
652 pDevice->usb,
653 usb_sndbulkpipe(pDevice->usb, 3),
654 (void *) &(pContext->Data[0]),
655 pContext->uBufLen,
656 s_nsBulkOutIoCompleteWrite,
657 pContext);
659 status = usb_submit_urb(pUrb, GFP_ATOMIC);
660 if (status != 0)
662 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit Tx URB failed %d\n", status);
663 return STATUS_FAILURE;
665 return STATUS_PENDING;
667 else {
668 pContext->bBoolInUse = FALSE;
669 return STATUS_RESOURCES;
674 * Description: s_nsBulkOutIoCompleteWrite
675 * 1a) Indicate to the protocol the status of the write.
676 * 1b) Return ownership of the packet to the protocol.
678 * 2) If any more packets are queue for sending, send another packet
679 * to USBD.
680 * If the attempt to send the packet to the driver fails,
681 * return ownership of the packet to the protocol and
682 * try another packet (until one succeeds).
684 * Parameters:
685 * In:
686 * pdoUsbDevObj - pointer to the USB device object which
687 * completed the irp
688 * pIrp - the irp which was completed by the
689 * device object
690 * pContext - the context given to IoSetCompletionRoutine
691 * before calling IoCallDriver on the irp
692 * The pContext is a pointer to the USB device object.
693 * Out:
694 * none
696 * Return Value: STATUS_MORE_PROCESSING_REQUIRED - allows the completion routine
697 * (IofCompleteRequest) to stop working on the irp.
700 static
701 void
702 s_nsBulkOutIoCompleteWrite(
703 struct urb *urb
706 PSDevice pDevice;
707 int status;
708 CONTEXT_TYPE ContextType;
709 unsigned long ulBufLen;
710 PUSB_SEND_CONTEXT pContext;
713 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkOutIoCompleteWrite\n");
715 // The context given to IoSetCompletionRoutine is an USB_CONTEXT struct
717 pContext = (PUSB_SEND_CONTEXT) urb->context;
718 ASSERT( NULL != pContext );
720 pDevice = pContext->pDevice;
721 ContextType = pContext->Type;
722 ulBufLen = pContext->uBufLen;
724 if (!netif_device_present(pDevice->dev))
725 return;
728 // Perform various IRP, URB, and buffer 'sanity checks'
731 status = urb->status;
732 //we should have failed, succeeded, or cancelled, but NOT be pending
733 STAvUpdateUSBCounter(&pDevice->scStatistic.USB_BulkOutStat, status);
735 if(status == STATUS_SUCCESS) {
736 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Write %d bytes\n",(int)ulBufLen);
737 pDevice->ulBulkOutBytesWrite += ulBufLen;
738 pDevice->ulBulkOutContCRCError = 0;
739 pDevice->nTxDataTimeCout = 0;
741 } else {
742 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BULK Out failed %d\n", status);
743 pDevice->ulBulkOutError++;
746 // pDevice->ulCheckForHangCount = 0;
747 // pDevice->pPendingBulkOutContext = NULL;
749 if ( CONTEXT_DATA_PACKET == ContextType ) {
750 // Indicate to the protocol the status of the sent packet and return
751 // ownership of the packet.
752 if (pContext->pPacket != NULL) {
753 dev_kfree_skb_irq(pContext->pPacket);
754 pContext->pPacket = NULL;
755 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"tx %d bytes\n",(int)ulBufLen);
758 pDevice->dev->trans_start = jiffies;
761 if (status == STATUS_SUCCESS) {
762 pDevice->packetsSent++;
764 else {
765 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Send USB error! [%08xh]\n", status);
766 pDevice->packetsSentDropped++;
770 if (pDevice->bLinkPass == TRUE) {
771 if (netif_queue_stopped(pDevice->dev))
772 netif_wake_queue(pDevice->dev);
774 pContext->bBoolInUse = FALSE;
776 return;