qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ehci: fix infinite loop with usb netdevice
@ 2010-04-16  3:19 David S. Ahern
  2010-04-19 21:26 ` [Qemu-devel] " Jan Kiszka
  0 siblings, 1 reply; 2+ messages in thread
From: David S. Ahern @ 2010-04-16  3:19 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 961 bytes --]

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

[-- Attachment #2: ehci-netdev.patch --]
[-- Type: text/plain, Size: 1001 bytes --]

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;
         }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Qemu-devel] Re: [PATCH] ehci: fix infinite loop with usb netdevice
  2010-04-16  3:19 [Qemu-devel] [PATCH] ehci: fix infinite loop with usb netdevice David S. Ahern
@ 2010-04-19 21:26 ` Jan Kiszka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kiszka @ 2010-04-19 21:26 UTC (permalink / raw)
  To: David S. Ahern; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1347 bytes --]

David S. Ahern wrote:
> 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.
> 

Thanks merged (a git-formatted patch would have been even better :) ).

Yeah, the behavior is as before here as well. So there was or was not
USB traffic between device and controller that points to incoming
frames? Guess we need to debug through the device if there was.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-19 21:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-16  3:19 [Qemu-devel] [PATCH] ehci: fix infinite loop with usb netdevice David S. Ahern
2010-04-19 21:26 ` [Qemu-devel] " Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).