linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] serial_core: Update buffer overrun statistics.
@ 2012-05-04 17:35 Corbin Atkinson
  2012-05-15 15:53 ` Alan Cox
  0 siblings, 1 reply; 16+ messages in thread
From: Corbin Atkinson @ 2012-05-04 17:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Alan Cox; +Cc: linux-serial, Corbin Atkinson

Currently, serial drivers don't report buffer overruns. When a buffer overrun
occurs, tty_insert_flip_char returns 0, and no attempt is made to insert that
same character again (i.e. it is lost). This patch reports buffer overruns via
the buf_overrun field in the port's icount structure.

Signed-off-by: Corbin Atkinson <corbin.atkinson@ni.com>
---
 drivers/tty/serial/serial_core.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 9c4c05b..59fb3ba 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2526,14 +2526,16 @@ void uart_insert_char(struct uart_port *port, unsigned int status,
 	struct tty_struct *tty = port->state->port.tty;
 
 	if ((status & port->ignore_status_mask & ~overrun) == 0)
-		tty_insert_flip_char(tty, ch, flag);
+		if (tty_insert_flip_char(tty, ch, flag) == 0)
+			++port->icount.buf_overrun;
 
 	/*
 	 * Overrun is special.  Since it's reported immediately,
 	 * it doesn't affect the current character.
 	 */
 	if (status & ~port->ignore_status_mask & overrun)
-		tty_insert_flip_char(tty, 0, TTY_OVERRUN);
+		if (tty_insert_flip_char(tty, 0, TTY_OVERRUN) == 0)
+			++port->icount.buf_overrun;
 }
 EXPORT_SYMBOL_GPL(uart_insert_char);
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-06-06 22:47 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-04 17:35 [PATCH 1/1] serial_core: Update buffer overrun statistics Corbin Atkinson
2012-05-15 15:53 ` Alan Cox
2012-05-15 15:58   ` Greg Kroah-Hartman
2012-05-15 16:20     ` Corbin
2012-05-15 16:27       ` Alan Cox
2012-05-15 18:41         ` Corbin
2012-05-15 19:34           ` Jason Smith
2012-05-15 21:08           ` Alan Cox
2012-05-15 22:46             ` Corbin
2012-05-21 15:12               ` Jason Smith
2012-05-21 16:05                 ` Alan Cox
2012-05-22 20:31                   ` Corbin
2012-05-22 20:38                     ` Jiri Slaby
2012-05-23 14:37                       ` Corbin
2012-06-06 22:34                         ` Corbin
2012-06-06 22:50                           ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).