Re: serial flow control appears broken

From: Maciej W. Rozycki
Date: Mon Jul 30 2007 - 05:35:15 EST


On Fri, 27 Jul 2007, Robert Hancock wrote:

> > The TTY line discipline driver could do that based on the amount of received
> > data present in its buffer. And it should if asked to (a brief look at
> > drivers/char/n_tty.c reveals it does; obviously there may be a bug
>
> Really, where? In my look through the code I haven't found any mechanism that
> would result in RTS being lowered based on TTY buffers filling up, at least
> not in the 8250 case.

Look for calls to ->throttle() and ->unthrottle(). XON and XOFF might be
used instead as a result of these calls though, depending on terminal
settings.

> In this situation, though, it appears it's not the TTY buffers that are
> filling but the UART's own buffer. I would think this must be caused by some
> kind of interrupt latency that results in not draining the FIFO in time.

Well, the UART only has its FIFO which is rather small, so automatic flow
control would be useful. Though, admittedly, tty_insert_flip_char() might
return some kind of a status related to how much space is left in the
receive buffer which would indicate that there is a lag in data stream
processing -- which in turn may relate to the system being loaded, so that
the receive ISR could decide whether to negate RTS itself for the less
capable UARTs (i.e. ones with no autoflow and a tiny or no FIFO).

Maciej
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/