[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 18/18] ehci: rework frame skipping
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 18/18] ehci: rework frame skipping |
Date: |
Fri, 25 May 2012 14:40:34 +0200 |
Move the framecount check out of the loop and use the new
ehci_update_frindex function to skip frames if needed.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/hcd-ehci.c | 25 ++++++++++---------------
1 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index d97c539..5298204 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2315,9 +2315,8 @@ static void ehci_frame_timer(void *opaque)
int schedules = 0;
int64_t expire_time, t_now;
uint64_t ns_elapsed;
- int frames;
+ int frames, skipped_frames;
int i;
- int skipped_frames = 0;
t_now = qemu_get_clock_ns(vm_clock);
ns_elapsed = t_now - ehci->last_run_ns;
@@ -2327,15 +2326,17 @@ static void ehci_frame_timer(void *opaque)
schedules++;
expire_time = t_now + (get_ticks_per_sec() / FRAME_TIMER_FREQ);
+ if (frames > ehci->maxframes) {
+ skipped_frames = frames - ehci->maxframes;
+ ehci_update_frindex(ehci, skipped_frames);
+ ehci->last_run_ns += FRAME_TIMER_NS * skipped_frames;
+ frames -= skipped_frames;
+ DPRINTF("WARNING - EHCI skipped %d frames\n", skipped_frames);
+ }
+
for (i = 0; i < frames; i++) {
ehci_update_frindex(ehci, 1);
-
- if (frames - i > ehci->maxframes) {
- skipped_frames++;
- } else {
- ehci_advance_periodic_state(ehci);
- }
-
+ ehci_advance_periodic_state(ehci);
ehci->last_run_ns += FRAME_TIMER_NS;
}
} else {
@@ -2348,12 +2349,6 @@ static void ehci_frame_timer(void *opaque)
ehci->last_run_ns += FRAME_TIMER_NS * frames;
}
-#if 0
- if (skipped_frames) {
- DPRINTF("WARNING - EHCI skipped %d frames\n", skipped_frames);
- }
-#endif
-
/* Async is not inside loop since it executes everything it can once
* called
*/
--
1.7.1
- [Qemu-devel] [PATCH 10/18] ehci: kick async schedule on wakeup, (continued)
- [Qemu-devel] [PATCH 10/18] ehci: kick async schedule on wakeup, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 12/18] ehci: add ehci_*_enabled() helpers, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 05/18] ehci: add queuing support, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 14/18] ehci: fix halt status handling, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 04/18] ehci: move ehci_flush_qh, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 13/18] ehci: update status bits in ehci_set_state, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 03/18] ehci: cache USBDevice in EHCIQueue, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 01/18] ehci: add EHCIPacket, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 09/18] ehci: schedule async bh on async packet completion, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 17/18] ehci: adaptive wakeup rate., Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 18/18] ehci: rework frame skipping,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 15/18] ehci: remove unused attach_poll_counter, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 16/18] ehci: create ehci_update_frindex, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 07/18] ehci: add async field to EHCIQueue, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 02/18] ehci: make ehci_execute work on EHCIPacket instead of EHCIQueue, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 08/18] ehci: move async schedule to bottom half, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 11/18] ehci: fix reset, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 06/18] ehci: tweak queue initialization, Gerd Hoffmann, 2012/05/25