tty: Sort out the USB sysrq changes that wrecked performance
authorAlan Cox <alan@linux.intel.com>
Thu, 9 Jul 2009 12:35:52 +0000 (13:35 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 11 Jul 2009 02:17:22 +0000 (19:17 -0700)
We can't go around calling all sorts of magic per character functions at
full rate 3G data speed.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/usb/serial/generic.c

index 932d6241b787d2c399bae70f70bec85e4c979d71..3d8dc5671beaca5eeb4500bdd3adcb9c5a965a5e 100644 (file)
@@ -424,10 +424,17 @@ static void flush_and_resubmit_read_urb(struct usb_serial_port *port)
        if (!tty)
                goto done;
 
-       /* Push data to tty */
-       for (i = 0; i < urb->actual_length; i++, ch++) {
-               if (!usb_serial_handle_sysrq_char(port, *ch))
-                       tty_insert_flip_char(tty, *ch, TTY_NORMAL);
+       /* The per character mucking around with sysrq path it too slow for
+          stuff like 3G modems, so shortcircuit it in the 99.9999999% of cases
+          where the USB serial is not a console anyway */
+       if (!port->console || !port->sysrq)
+               tty_insert_flip_string(tty, ch, urb->actual_length);
+       else {
+               /* Push data to tty */
+               for (i = 0; i < urb->actual_length; i++, ch++) {
+                       if (!usb_serial_handle_sysrq_char(port, *ch))
+                               tty_insert_flip_char(tty, *ch, TTY_NORMAL);
+               }
        }
        tty_flip_buffer_push(tty);
        tty_kref_put(tty);