• David Brownell's avatar
    USB: serial gadget: rx path data loss fixes · 937ef73d
    David Brownell authored
    Update RX path handling in new serial gadget code to cope better with
    RX blockage:  queue every RX packet until its contents can safely be
    passed up to the ldisc.  Most of the RX path work is now done in the
    RX tasklet, instead of just the final "push to ldisc" step.  This
    addresses some cases of data loss:
    
      - A longstanding serial gadget bug: when tty_insert_flip_string()
        didn't copy the entire buffer, the rest of the characters were
        dropped!  Now that packet stays queued until the rest of its data
        is pushed to the ldisc.
    
      - Another longstanding issue:  in the unlikely case that an RX
        transfer returns data and also reports a fault, that data is
        no longer discarded.
    
      - In the recently added RX throttling logic:  it needs to stop
        pushing data into the TTY layer, instead of just not submitting
        new USB read requests.  When the TTY is throttled long enough,
        backpressure will eventually make the OUT endpoint NAK.
    
    Also: an #ifdef is removed (no longer necessary); and start switching
    to a better convention for debug messages (prefix them with tty name).
    Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    937ef73d
u_serial.c 32.6 KB