Small thinko in serial.c

Rogier Wolff (R.E.Wolff@BitWizard.nl)
Wed, 29 Sep 1999 21:05:36 +0200 (MEST)


Hi,

I got bitten by this today:

diff -ur linux-2.2.13pre8.clean/drivers/char/serial.c linux/drivers/char/serial.c
--- linux-2.2.13pre8.clean/drivers/char/serial.c Wed Sep 22 12:05:21 1999
+++ linux/drivers/char/serial.c Wed Sep 29 20:54:17 1999
@@ -1693,7 +1693,7 @@
if ((new_serial.type != state->type) ||
(new_serial.xmit_fifo_size <= 0))
new_serial.xmit_fifo_size =
- uart_config[state->type].dfl_xmit_fifo_size;
+ uart_config[new_serial.type].dfl_xmit_fifo_size;

/* Make sure address is not already in use */
if (new_serial.type) {

When you use setserial to change the uart type, the code will use the
default xmit_fifo_size of the OLD uart....

I'm seeing an occasional 1182 chars that are duplicated in a serial
stream. Could this be a race somewhere? My guess is that nobody is
using serial lines for anything else than PPP to an ISP, so nobody
will notice the occasional corrupted packet.... I'm also seeing too
many overruns (for 115k2 with hardware handshake). I'm still
investigating.

Another thing that I'm seeing is that the serial driver will drain the
tx buffer until it's empty, and then reload the whole buffer. At 115k2
that means that there is less than 90 us to refill the output buffer.
Wouldn't it be better to call for a refill a few characters before the
buffer empties completely? Especially newer UARTS like the OX16C950,
as they allow you to read the FIFO fill level, so that you only need
one IO per byte instead of two.

Roger.

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
------ Microsoft SELLS you Windows, Linux GIVES you the whole house ------

- 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/