Re: [PATCH] [2.5] adding ppp xon/xoff support

Samuel Thibault (Samuel.Thibault@ens-lyon.fr)
Fri, 11 Jul 2003 22:42:16 -0400


Le sam 12 jui 2003 11:30:48 GMT, Paul Mackerras a tapoté sur son clavier :
> Samuel Thibault writes:
>
> > This patch wasn't applied, probably because the misplaced else
> > statement, here is a corrected version. This would at last make linux
> > support xon/xoff for ppp connections (it hasn't been available since 2.0
> > at least).
> >
> > Please apply,
>
> Have you tested it? If so, how?

I've been testing it for 3 years now :) I have my own ppp implementation
on my calculator, and I really needed xon/xoff.

I've just tested it again with 2.5.75: I run a program on the calc which
shows the current buffer length and sends a XOFF as soon as 100 bytes are
available.

I then launch /usr/sbin/pppd /dev/ttyS0 9600 local xonxoff passive on
the linux side.

Without the patch, the buffer length increases until the buffer is full.
With the patch, it stops at 106 bytes as expected (2 configure
requests, the calculator being too slow to be able to send XOFF as soon
as the 100th bytes arrives). If you launch pppd without any argument
(hence having /dev/tty1 used by pppd), you can even see the keyboard
scroll lock light lit when pressing ^S (the tty->stop() stuff seems to do
that)

Well, I had a look at tty_io.c, and it changed a little bit, so although
it works in my case, the previous patch might not be sufficient. Here is a
maybe much better patch which has tty_io.c export start_tty() and
stop_tty(), so that ppp_async can call them even when module-loaded.
(I tested it again)

Regards,
Samuel Thibault

diff -ur linux-2.5.75-orig/drivers/char/tty_io.c linux-2.5.75-perso/drivers/char/tty_io.c
--- linux-2.5.75-orig/drivers/char/tty_io.c 2003-07-11 22:37:57.000000000 -0400
+++ linux-2.5.75-perso/drivers/char/tty_io.c 2003-07-11 22:37:31.000000000 -0400
@@ -611,6 +611,8 @@
(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 @@
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 -ur linux-2.5.75-orig/drivers/net/ppp_async.c linux-2.5.75-perso/drivers/net/ppp_async.c
--- linux-2.5.75-orig/drivers/net/ppp_async.c 2003-07-10 16:12:49.000000000 -0400
+++ linux-2.5.75-perso/drivers/net/ppp_async.c 2003-07-11 22:24:37.000000000 -0400
@@ -891,6 +891,11 @@
process_input_packet(ap);
} else if (c == PPP_ESCAPE) {
ap->state |= SC_ESCAPE;
+ } else if (I_IXON(ap->tty)) {
+ if (c == STOP_CHAR(ap->tty))
+ stop_tty(ap->tty);
+ else if (c == START_CHAR(ap->tty))
+ start_tty(ap->tty);
}
/* otherwise it's a char in the recv ACCM */
++n;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/