From patchwork Fri Apr 16 03:19:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "David S. Ahern" X-Patchwork-Id: 50303 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5AD54B7D60 for ; Fri, 16 Apr 2010 13:20:49 +1000 (EST) Received: from localhost ([127.0.0.1]:44092 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O2c6o-00032G-2x for incoming@patchwork.ozlabs.org; Thu, 15 Apr 2010 23:20:46 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O2c6D-00031V-MO for qemu-devel@nongnu.org; Thu, 15 Apr 2010 23:20:09 -0400 Received: from [140.186.70.92] (port=47365 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O2c68-0002zF-1J for qemu-devel@nongnu.org; Thu, 15 Apr 2010 23:20:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O2c66-00075S-9P for qemu-devel@nongnu.org; Thu, 15 Apr 2010 23:20:03 -0400 Received: from sj-iport-6.cisco.com ([171.71.176.117]:65506) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O2c66-00072i-3y for qemu-devel@nongnu.org; Thu, 15 Apr 2010 23:20:02 -0400 Authentication-Results: sj-iport-6.cisco.com; dkim=neutral (message not signed) header.i=none X-Files: ehci-netdev.patch : 1001 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEALd0x0urR7Hu/2dsb2JhbACbbXGkEZonhAuBAwSDKw X-IronPort-AV: E=Sophos;i="4.52,216,1270425600"; d="scan'208";a="515932597" Received: from sj-core-5.cisco.com ([171.71.177.238]) by sj-iport-6.cisco.com with ESMTP; 16 Apr 2010 03:19:58 +0000 Received: from [10.89.1.73] (rcdn-vpn-client-10-89-1-73.cisco.com [10.89.1.73]) by sj-core-5.cisco.com (8.13.8/8.14.3) with ESMTP id o3G3JwRH017482; Fri, 16 Apr 2010 03:19:58 GMT Message-ID: <4BC7D75D.9020302@cisco.com> Date: Thu, 15 Apr 2010 21:19:57 -0600 From: "David S. Ahern" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc12 Thunderbird/3.0.4 MIME-Version: 1.0 To: Jan Kiszka X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] ehci: fix infinite loop with usb netdevice X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Hi Jan: The attached addresses the spinning with the usb net device. Now I can enable the device and ethtool shows a link: # ifconfig usb0 up # ethtool usb0 Settings for usb0: Current message level: 0x00000007 (7) Link detected: yes Though dhclient still can't get an address. After a bit of instrumentation it appears that packets are lost in the receive the path somewhere: usb0 Link encap:Ethernet HWaddr 42:5F:CA:51:54:77 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:25 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:5513 (5.3 KiB) I looked at an x3650M2 with an IMM. It has a usb-based ethernet device. I compared the output of lsusb -v from the IMM with the qemu usb net device and nothing jumps out -- other than the fact that the IMM's network device shows up on a uhci bus. David diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c index f806a20..218d590 100644 --- a/hw/usb-ehci.c +++ b/hw/usb-ehci.c @@ -981,13 +981,15 @@ err: qh->token |= QTD_TOKEN_HALT; break; case USB_RET_NAK: + /* 4.10.3 */ reload = get_field(qh->epchar, QH_EPCHAR_RL); if ((ehci->pid == USB_TOKEN_IN) && reload) { int nakcnt = get_field(qh->altnext_qtd, QH_ALTNEXT_NAKCNT); nakcnt--; set_field(&qh->altnext_qtd, nakcnt, QH_ALTNEXT_NAKCNT); + } else if (!reload) { + return USB_RET_NAK; } - return USB_RET_NAK; break; case USB_RET_BABBLE: fprintf(stderr, "USB babble TODO\n"); @@ -1040,7 +1042,7 @@ err: ret += ehci->more; - if (ret > ehci->tbytes) { + if ((ret > ehci->tbytes) && (ehci->pid == USB_TOKEN_IN)) { ret = USB_RET_BABBLE; goto err; }