From nobody@FreeBSD.org  Tue Oct 23 09:05:20 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 63A5837B406
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 23 Oct 2001 09:05:20 -0700 (PDT)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.4/8.11.4) id f9NG5Ku28308;
	Tue, 23 Oct 2001 09:05:20 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200110231605.f9NG5Ku28308@freefall.freebsd.org>
Date: Tue, 23 Oct 2001 09:05:20 -0700 (PDT)
From: Hiroyuki Aizu <aizu@navi.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH] ohci driver problem when send data with USBD_FORCE_SHORT_XFER flag.
X-Send-Pr-Version: www-1.0

>Number:         31455
>Category:       kern
>Synopsis:       [PATCH] ohci driver problem when send data with USBD_FORCE_SHORT_XFER flag.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    n_hibma
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 23 09:10:00 PDT 2001
>Closed-Date:    Fri Aug 27 22:32:05 GMT 2004
>Last-Modified:  Fri Aug 27 22:32:05 GMT 2004
>Originator:     Hiroyuki Aizu
>Release:        4-STABLE and 4.3-RELEASE 4.4-RELEASE
>Organization:
>Environment:
FreeBSD one.navi.org 4.4-STABLE FreeBSD 4.4-STABLE #13: Tue Oct 23 16:55:38 JST 2001     aizu@one.navi.org:/usr/src/sys/compile/ONE  i386
>Description:
The USB Ethernet adoptor that use the aue driver didn't work with OHCI controller machine.
Because when any packet send to anywhere, aue driver try to transfer the data with set USBD_FORCE_SHORT_XFER flag on,
the OHCI driver failed handling 0 size packet.
The NetBSD's code was helpfull to solve this problem.

>How-To-Repeat:
Plug the aue USB Ethernet adoptor to the machine that have USB OHCI controller and send packet anywhere.


>Fix:
Apply following patch.
This fix  effective to both of -stable and -current, I think.

--- ohci.c.orig Wed Nov  1 08:23:29 2000
+++ ohci.c      Tue Oct 23 16:55:12 2001
@@ -551,6 +551,10 @@
        if ((flags & USBD_FORCE_SHORT_XFER) &&
            len % UGETW(opipe->pipe.endpoint->edesc->wMaxPacketSize) == 0) {
                /* Force a 0 length transfer at the end. */
+
+               cur->td.td_flags = LE(tdflags | OHCI_TD_NOINTR);
+               cur = next;
+
                next = ohci_alloc_std(sc);
                if (next == 0)
                        goto nomem;
@@ -559,10 +563,9 @@
                cur->td.td_cbp = 0; /* indicate 0 length packet */
                cur->nexttd = next;
                cur->td.td_nexttd = LE(next->physaddr);
-               cur->td.td_be = LE(dataphys - 1);
+               cur->td.td_be = ~0;
                cur->len = 0;
                cur->flags = 0;
-               cur = next;
                DPRINTFN(2,("ohci_alloc_std_chain: add 0 xfer\n"));
        }
        cur->flags = OHCI_CALL_DONE | OHCI_ADD_LEN;

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: n_hibma 
State-Changed-When: Tue Oct 23 16:10:06 PDT 2001 
State-Changed-Why:  
This is a not working case, nothing that breaks the machine. 



Responsible-Changed-From-To: freebsd-bugs->n_hibma 
Responsible-Changed-By: n_hibma 
Responsible-Changed-When: Tue Oct 23 16:10:06 PDT 2001 
Responsible-Changed-Why:  
USB is my turf. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=31455 

From: SADA Kenji <sada@bsdclub.org>
To: freebsd-gnats-submit@FreeBSD.org, aizu@navi.org
Cc:  
Subject: Re: kern/31455: [PATCH] ohci driver probrem when send data with USBD_FORCE_SHORT_XFER flag.
Date: Fri, 8 Feb 2002 16:28:27 +0900

 FYI: including the submitter, three persons said that
 their problem have solved by this patch.
 [FreeBSD-users-jp 65061]
 
 --
 SADA Kenji <sada@FreeBSD.org>

From: "Bryan K. Ogawa" <bko@unobvious.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc: aizu@navi.org, <n_hibma@FreeBSD.org>
Subject: Re: kern/31455: [PATCH] ohci driver probrem when send data with
 USBD_FORCE_SHORT_XFER flag.
Date: Sun, 30 Jun 2002 23:04:20 -0700 (PDT)

 Another report -- this patch (actually , I applied all of netbsd's ohci.c
 1.75) fixed this for me.
 
 However, i would get infinte looping of read errors after a while.  that
 might be a separate bug, and this definitely fixes things from not working
 to somewhat working for me.
 
 -- 
 bryan k ogawa  <bko@unobvious.com>   http://www.unobvious.com/
 

From: Nick Hibma <n_hibma@webweaving.org>
To: freebsd-gnats-submit@FreeBSD.org, aizu@navi.org
Cc:  
Subject: Re: kern/31455: [PATCH] ohci driver probrem when send data with 
 USBD_FORCE_SHORT_XFER flag.
Date: Mon, 01 Jul 2002 22:27:34 +0200

 This is implemented in CURRENT (the CURRENT code is pretty much in sync
 with the NetBSD code).
 
 That version should be backported to STABLE.
State-Changed-From-To: analyzed->closed 
State-Changed-By: linimon 
State-Changed-When: Fri Aug 27 22:31:12 GMT 2004 
State-Changed-Why:  
Fixed in a long-ago version of -current. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=31455 
>Unformatted:
