All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Fulghum <paulkf@microgate.com>
To: craigeger@comcast.net
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Fwd: PROBLEM: serial port receive buffers not being flushed properly
Date: Fri, 27 Jul 2007 10:50:13 -0500	[thread overview]
Message-ID: <1185551413.3285.13.camel@x2.microgate.com> (raw)

From: craigeger@comcast.net
> [1.] PROBLEM: serial port receive buffers not being flushed properly
> [2.] After calling tcflush() or ioctl() with the TCFLSH argument,
> an ioctl() with the FIONREAD argument reports 0 bytes available
> for reading. However, a subsequent select() and read() of the port
> returns data. This problem is seen in 2.6.21.1 and 2.6.20,
> but is not seen in version 2.6.17.14. Other versions have
> not been tested.

There is receive buffering between the serial driver and
line discipline. The line discipline processes FIONREAD
and TCFLSH with regard to the line discipline receive
buffers but not the intermediate buffering.

In 2.6.17 the intermediate buffering pushed
receive data to the line discipline without
regard for tty->receive_room, so if the ldisc buffers
were full the data was lost.

In 2.6.18 the intermediate buffering was changed to
hold receive data until the line discipline could
accept it.

So in 2.6.17 all the extra data you sent was simply
discarded and flushing the ldisc buffers cleared all
of the receive data. Starting with 2.6.18, flushing the
ldisc buffers just allowed the intermediate buffering to
start feeding more data to the ldisc. This results in the
receive data you see after a TCFLSH.

Starting with 2.6.22 TCFLSH is processed by the intermediate
buffering as well as the ldisc to eliminate any remaining
receive data in the intermediate buffering.


--
Paul Fulghum
Microgate Systems, Ltd


             reply	other threads:[~2007-07-27 15:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-27 15:50 Paul Fulghum [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-07-27 15:08 Fwd: PROBLEM: serial port receive buffers not being flushed properly Russell King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1185551413.3285.13.camel@x2.microgate.com \
    --to=paulkf@microgate.com \
    --cc=craigeger@comcast.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.