Re: [PATCH] USB: cdc-acm: Prevent data loss when filling tty buffer.

From: Toby Gray
Date: Mon Mar 21 2011 - 13:58:39 EST

On 21/03/2011 16:56, Alan Cox wrote:
On Mon, 21 Mar 2011 15:52:25 +0000
Toby Gray<toby.gray@xxxxxxxxxxx> wrote:

This patch adds checking for how many bytes have been inserted into the tty
buffer and returns any remaining bytes back to the filled read buffer list.
How does ACM handle flow control - is the expectation that it gets flow
controlled in hardware by not having the opportunity to send bits
to the host end ? If so this seems to make sense.
Yes, the expectation is that it is flow controlled in hardware if a bulk endpoint is used. To this end cdc-acm.ko doesn't issue any new read requests while the tty is throttled. This works as flow control most of the time, but not when the data is arriving quickly (a few megabytes per second).

Thank you for your other comments. I had initially gone for the memmove thinking that having a buffer head as well as a base would have needlessly complicated the rest of the code.

Having made the required changes it seems I'd greatly overestimated the changes and it is definitely far cleaner without the memmove.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at