
From: samuel.thibault@fnac.net

The asynchronous ppp layer should handle xon/xoff characters itself, just
like n_tty.c does.  Some serial chipset can handle xon/xoff themselves, but
8250/16450 can't for instance, so ppp_async.c should do it itself.

Here is a patch to correct this, it is really much like a cut & paste of
n_tty.c's handling.  The character handling is done at the same level as
Escape characters handling, so it copes correctly with the accm.  It was
very well tested under kernel 2.2, 2.4 and now 2.5/2.6.

(Was acked by Paul Mackerras)


 drivers/char/tty_io.c   |    4 ++++
 drivers/net/ppp_async.c |    5 +++++
 2 files changed, 9 insertions(+)

diff -puN drivers/char/tty_io.c~ppp-xon-xoff-handling drivers/char/tty_io.c
--- 25/drivers/char/tty_io.c~ppp-xon-xoff-handling	2003-07-28 18:11:40.000000000 -0700
+++ 25-akpm/drivers/char/tty_io.c	2003-07-28 18:11:40.000000000 -0700
@@ -611,6 +611,8 @@ void stop_tty(struct tty_struct *tty)
 		(tty->driver->stop)(tty);
 }
 
+EXPORT_SYMBOL(stop_tty);
+
 void start_tty(struct tty_struct *tty)
 {
 	if (!tty->stopped || tty->flow_stopped)
@@ -629,6 +631,8 @@ void start_tty(struct tty_struct *tty)
 	wake_up_interruptible(&tty->write_wait);
 }
 
+EXPORT_SYMBOL(start_tty);
+
 static ssize_t tty_read(struct file * file, char * buf, size_t count, 
 			loff_t *ppos)
 {
diff -puN drivers/net/ppp_async.c~ppp-xon-xoff-handling drivers/net/ppp_async.c
--- 25/drivers/net/ppp_async.c~ppp-xon-xoff-handling	2003-07-28 18:11:40.000000000 -0700
+++ 25-akpm/drivers/net/ppp_async.c	2003-07-28 18:11:40.000000000 -0700
@@ -891,6 +891,11 @@ ppp_async_input(struct asyncppp *ap, con
 			process_input_packet(ap);
 		} else if (c == PPP_ESCAPE) {
 			ap->state |= SC_ESCAPE;
+		} else if (I_IXON(ap->tty)) {
+			if (c == START_CHAR(ap->tty))
+				start_tty(ap->tty);
+			else if (c == STOP_CHAR(ap->tty))
+				stop_tty(ap->tty);
 		}
 		/* otherwise it's a char in the recv ACCM */
 		++n;

_
