aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-03-02 21:27:17 +0100
committerGerd Hoffmann <kraxel@redhat.com>2012-03-07 12:28:04 +0100
commit553a6a59f6931bf3a034945e0c1585f4b05d6000 (patch)
treebf0ba44ef81f22fa28c9745e876ddec23b6d9131 /block
parentaa73fcdcc1bf4157121716e2eb3230130b0d1232 (diff)
downloadqemu-553a6a59f6931bf3a034945e0c1585f4b05d6000.zip
qemu-553a6a59f6931bf3a034945e0c1585f4b05d6000.tar.gz
qemu-553a6a59f6931bf3a034945e0c1585f4b05d6000.tar.bz2
usb-ehci: Fix and simplify nakcnt handling
The nakcnt code in ehci_execute_complete() marked transactions as finished when a packet completed with a result of USB_RET_NAK, but USB_RET_NAK means that the device cannot receive / send data at that time and that the transaction should be retried later, which is also what the usb-uhci and usb-ohci code does. Note that there already was some special code in place to handle this for interrupt endpoints in the form of doing a return from ehci_execute_complete() when reload == 0, but that for bulk transactions this was not handled correctly (where as for example the usb-ccid device does return USB_RET_NAK for bulk packets). Besides that the code in ehci_execute_complete() decrement nakcnt by 1 on a packet result of USB_RET_NAK, but -since the transaction got marked as finished, nakcnt would never be decremented again -there is no code checking for nakcnt becoming 0 -there is no use in re-trying the transaction within the same usb frame / usb-ehci frame-timer call, since the status of emulated devices won't change as long as the usb-ehci frame-timer is running So we should simply set the nakcnt to 0 when we get a USB_RET_NAK, thus claiming that we've tried reload times (or as many times as possible if reload is 0). Besides the code in ehci_execute_complete() handling USB_RET_NAK there was also code handling it in ehci_state_executing(), which calls ehci_execute_complete(), and then does its own handling on top of the handling in ehci_execute_complete(), this code would decrement nakcnt *again* (if not already 0), or restore the reload value (which was never changed) on success. Since the double decrement was wrong to begin with, and is no longer needed now that we set nakcnt directly to 0 on USB_RET_NAK, and the restore of reload is not needed either, this patch simply removes all nakcnt handling from ehci_state_executing(). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'block')
0 files changed, 0 insertions, 0 deletions