Re: TTY Flip buffers

tytso@mit.edu
Tue, 23 Nov 1999 14:49:01 -0500


Date: Tue, 23 Nov 1999 08:57:41 -0800 (PST)
From: Linux Lists <lists@cyclades.com>

Note that the char_buf buffer size is 2*TTY_FLIPBUF_SIZE. However, all
serial drivers check the value TTY_FLIPBUF_SIZE in order to know whether
the buffer is full or not.

Is this correct?? Shouldn't the serial drivers be checking for
2*TTY_FLIPBUF_SIZE?? Aren't the serial drivers subutilizing the flip
buffers in this way??

The existing code is correct. The reason why the buffer is
2*TTY_FLIPBUF_SIZE is that we're doing double buffering; first one half
of the buffer is filled, while the other half is being processed by the
line discpline, and then the two (half) buffers are flipped --- this the
name "flip buffers". It really is double buffering by another name; I
wasn't familiar with the more commonly used name when I reinvented the
technique for Linux. :-)

Another question: if I want to use a larger flip buffer, can I just
allocate the required memory amount and set the pointers char_buf_ptr and
flag_buf_ptr?? If not, I don't see the reason for the existence of these
pointers ...

You have to change the routines that set and reset those pointers when
the flip buffers are flipped. There is a patch outstanding to allow
bigger flip buffers, and I'll hopefully have a chance to look at it over
Thanksgiving weekend. (My apologies Pavel for my delay in looking over
your patch; I've been swamped lately.)

- Ted

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