Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/dwc2/dist Adapt the NAK holdoff scheme for ...



details:   https://anonhg.NetBSD.org/src/rev/fe5f7fc0497c
branches:  trunk
changeset: 802109:fe5f7fc0497c
user:      skrll <skrll%NetBSD.org@localhost>
date:      Wed Sep 03 10:00:08 2014 +0000

description:
Adapt the NAK holdoff scheme for FS/LS devices from the Raspberry Pi
Foundation driver.

Should fix PR/49019 - RPI: interrupt storm when url0 is up

diffstat:

 sys/external/bsd/dwc2/dist/dwc2_hcd.c      |  21 +++++++++++++++++++--
 sys/external/bsd/dwc2/dist/dwc2_hcd.h      |   4 +++-
 sys/external/bsd/dwc2/dist/dwc2_hcdintr.c  |  15 +++++++++++++--
 sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c |   5 +++--
 4 files changed, 38 insertions(+), 7 deletions(-)

diffs (129 lines):

diff -r 937e2495d880 -r fe5f7fc0497c sys/external/bsd/dwc2/dist/dwc2_hcd.c
--- a/sys/external/bsd/dwc2/dist/dwc2_hcd.c     Tue Sep 02 23:26:20 2014 +0000
+++ b/sys/external/bsd/dwc2/dist/dwc2_hcd.c     Wed Sep 03 10:00:08 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc2_hcd.c,v 1.13 2014/07/03 07:18:42 skrll Exp $      */
+/*     $NetBSD: dwc2_hcd.c,v 1.14 2014/09/03 10:00:08 skrll Exp $      */
 
 /*
  * hcd.c - DesignWare HS OTG Controller host-mode routines
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc2_hcd.c,v 1.13 2014/07/03 07:18:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_hcd.c,v 1.14 2014/09/03 10:00:08 skrll Exp $");
 
 #include <sys/types.h>
 #include <sys/kmem.h>
@@ -887,6 +887,23 @@
                if (list_empty(&hsotg->free_hc_list))
                        break;
                qh = list_entry(qh_ptr, struct dwc2_qh, qh_list_entry);
+
+               /*
+                * Check to see if this is a NAK'd retransmit, in which case
+                * ignore for retransmission. We hold off on bulk/control
+                * retransmissions to reduce NAK interrupt overhead for
+                * cheeky devices that just hold off using NAKs.
+                */
+               if (qh->do_split &&
+                   qh->nak_frame != 0xffff &&
+                   dwc2_full_frame_num(qh->nak_frame) ==
+                   dwc2_full_frame_num(dwc2_hcd_get_frame_number(hsotg))) {
+                       qh_ptr = qh_ptr->next;
+                       continue;
+               } else {
+                       qh->nak_frame = 0xffff;
+               }
+
                if (hsotg->core_params->uframe_sched > 0) {
                        if (hsotg->available_host_channels < 1)
                                break;
diff -r 937e2495d880 -r fe5f7fc0497c sys/external/bsd/dwc2/dist/dwc2_hcd.h
--- a/sys/external/bsd/dwc2/dist/dwc2_hcd.h     Tue Sep 02 23:26:20 2014 +0000
+++ b/sys/external/bsd/dwc2/dist/dwc2_hcd.h     Wed Sep 03 10:00:08 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc2_hcd.h,v 1.8 2014/04/03 06:34:58 skrll Exp $       */
+/*     $NetBSD: dwc2_hcd.h,v 1.9 2014/09/03 10:00:08 skrll Exp $       */
 
 /*
  * hcd.h - DesignWare HS OTG Controller host-mode declarations
@@ -243,6 +243,7 @@
  * @interval:           Interval between transfers in (micro)frames
  * @sched_frame:        (Micro)frame to initialize a periodic transfer.
  *                      The transfer executes in the following (micro)frame.
+ * @nak_frame:          Internal variable used by the NAK holdoff code
  * @frame_usecs:        Internal variable used by the microframe scheduler
  * @start_split_frame:  (Micro)frame at which last start split was initialized
  * @ntd:                Actual number of transfer descriptors in a list
@@ -277,6 +278,7 @@
        u16 usecs;
        u16 interval;
        u16 sched_frame;
+       u16 nak_frame;
        u16 frame_usecs[8];
        u16 start_split_frame;
        u16 ntd;
diff -r 937e2495d880 -r fe5f7fc0497c sys/external/bsd/dwc2/dist/dwc2_hcdintr.c
--- a/sys/external/bsd/dwc2/dist/dwc2_hcdintr.c Tue Sep 02 23:26:20 2014 +0000
+++ b/sys/external/bsd/dwc2/dist/dwc2_hcdintr.c Wed Sep 03 10:00:08 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc2_hcdintr.c,v 1.9 2014/07/26 09:18:53 skrll Exp $   */
+/*     $NetBSD: dwc2_hcdintr.c,v 1.10 2014/09/03 10:00:08 skrll Exp $  */
 
 /*
  * hcd_intr.c - DesignWare HS OTG Controller host-mode interrupt handling
@@ -40,7 +40,7 @@
  * This file contains the interrupt handlers for Host mode
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc2_hcdintr.c,v 1.9 2014/07/26 09:18:53 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_hcdintr.c,v 1.10 2014/09/03 10:00:08 skrll Exp $");
 
 #include <sys/types.h>
 #include <sys/pool.h>
@@ -1211,6 +1211,17 @@
                         chnum);
 
        /*
+        * When we get control/bulk NAKs then remember this so we holdoff on
+        * this qh until the beginning of the next frame
+        */
+       switch (dwc2_hcd_get_pipe_type(&qtd->urb->pipe_info)) {
+       case USB_ENDPOINT_XFER_CONTROL:
+       case USB_ENDPOINT_XFER_BULK:
+               chan->qh->nak_frame = dwc2_hcd_get_frame_number(hsotg);
+               break;
+       }
+
+       /*
         * Handle NAK for IN/OUT SSPLIT/CSPLIT transfers, bulk, control, and
         * interrupt. Re-start the SSPLIT transfer.
         */
diff -r 937e2495d880 -r fe5f7fc0497c sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c
--- a/sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c        Tue Sep 02 23:26:20 2014 +0000
+++ b/sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c        Wed Sep 03 10:00:08 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc2_hcdqueue.c,v 1.10 2014/07/03 07:18:42 skrll Exp $ */
+/*     $NetBSD: dwc2_hcdqueue.c,v 1.11 2014/09/03 10:00:08 skrll Exp $ */
 
 /*
  * hcd_queue.c - DesignWare HS OTG Controller host queuing routines
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc2_hcdqueue.c,v 1.10 2014/07/03 07:18:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_hcdqueue.c,v 1.11 2014/09/03 10:00:08 skrll Exp $");
 
 #include <sys/types.h>
 #include <sys/kmem.h>
@@ -94,6 +94,7 @@
        dev_speed = dwc2_host_get_speed(hsotg, urb->priv);
 
        dwc2_host_hub_info(hsotg, urb->priv, &hub_addr, &hub_port);
+       qh->nak_frame = 0xffff;
 
        if ((dev_speed == USB_SPEED_LOW || dev_speed == USB_SPEED_FULL) &&
            hub_addr != 0 && hub_addr != 1) {



Home | Main Index | Thread Index | Old Index