Subject: kern/20800: reading ppp over pseudo terminal maxes out at ~90 kb/sec
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jesseoff@yahoo.com>
List: netbsd-bugs
Date: 03/18/2003 22:47:00
>Number:         20800
>Category:       kern
>Synopsis:       reading ppp over pseudo terminal maxes out at ~90 kb/sec
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 18 22:48:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Jesse Off
>Release:        1.6.1
>Organization:
>Environment:
NetBSD angel 1.6.1_RC2 NetBSD 1.6.1_RC2 (GENERIC) #0: Fri Mar  7 10:16:20 MST 20
03     root@angelus:/usr/obj/usr/src/sys/arch/i386/compile/GENERIC i386
>Description:
reading from pseudo terminal master w/ ppp line discipline slave can not read more than 1024 (size of tty outq) bytes every clock tick. The relevant code from pppasyncstart() [ppp_tty.c]:

    /*
     * This timeout is needed for operation on a pseudo-tty,
     * because the pty code doesn't call pppstart after it has
     * drained the t_outq.
     */
    if (!idle && (sc->sc_flags & SC_TIMEOUT) == 0) {
        callout_reset(&sc->sc_timo_ch, 1, ppp_timeout, sc);
        sc->sc_flags |= SC_TIMEOUT;
    }

As a result, the tty outq is only filled once per clock tick, which is insufficient for fast ppp lines.

>How-To-Repeat:
I was trying to get l2tpd/IPSEC vpn networking over a local 100mbit network.  There are issues with l2tpd for netbsd I've had to fix to even get this far.  (improper term attrs for pty (loopbacked line error), improper assumption that each read(2) returns one frame in entirety (dropping/corrupting of large packets))
>Fix:
I can think of one, but its probably not the cleanest way. (have check in termios line discipline read for pseudo tty read of ppp discipline slave and call tty->sc_start() (pppasyncstart) on empty outq
>Release-Note:
>Audit-Trail:
>Unformatted: