Mercurial > ecos
changeset 1629:2609240c9126
* src/ppp_io.c:
* src/sys-ecos.c:
* src/ppp_io.h:
The wait_input function sometimes blocked even if a packet was
available for processing. Now checks the tty queue and then the
serial driver before blocking.
| author | nickg |
|---|---|
| date | Thu, 06 May 2004 14:46:32 +0000 |
| parents | 2e1811d4f88c |
| children | cf9bcc2eca1f |
| files | packages/net/ppp/current/ChangeLog packages/net/ppp/current/include/ppp_io.h packages/net/ppp/current/src/ppp_io.c packages/net/ppp/current/src/sys-ecos.c |
| diffstat | 4 files changed, 53 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/net/ppp/current/ChangeLog +++ b/packages/net/ppp/current/ChangeLog @@ -1,3 +1,12 @@ +2004-05-06 Mark Retallack <mark.retallack@siemens.com> + + * src/ppp_io.c: + * src/sys-ecos.c: + * src/ppp_io.h: + The wait_input function sometimes blocked even if a packet was + available for processing. Now checks the tty queue and then the + serial driver before blocking. + 2004-05-06 Jonathan Larmour <jifl@eCosCentric.com> * src/auth.c: Don't use non-eCos <paths.h>
--- a/packages/net/ppp/current/include/ppp_io.h +++ b/packages/net/ppp/current/include/ppp_io.h @@ -146,6 +146,8 @@ extern int cyg_ppp_pppread __P((struct t extern int cyg_ppp_pppclose __P((struct tty *tp, int flag)); +extern int cyg_ppp_pppcheck __P((struct tty *tp)); + // ==================================================================== // Start PPP transmission. This is called from the TX thread to cause // any pending packets to be sent.
--- a/packages/net/ppp/current/src/ppp_io.c +++ b/packages/net/ppp/current/src/ppp_io.c @@ -291,6 +291,43 @@ register struct ppp_softc *sc; db_printf("%s called\n", __PRETTY_FUNCTION__); } + + +//========================================================================== +/* + * function to check if data is available + */ + +int +cyg_ppp_pppcheck(tp) + register struct tty *tp; +{ + register struct ppp_softc *sc = (struct ppp_softc *)tp->t_sc; + int status = 0; + register int s; + + s = spltty(); + + if (tp != (struct tty *) sc->sc_devp ) { + splx(s); + return 0; + } + if (sc->sc_inq.ifq_head == NULL) + { + splx(s); + return 0; + } + + // if the queue is not empty + if ( IF_IS_EMPTY(&sc->sc_inq) == false) + status = 1; + + splx(s); + + return(status); +} + + //========================================================================== /* * Line specific (tty) read routine.
--- a/packages/net/ppp/current/src/sys-ecos.c +++ b/packages/net/ppp/current/src/sys-ecos.c @@ -593,6 +593,11 @@ void wait_input(timo) struct timeval *timo; { + // If there are any packets still waiting on the input queue then + // return immediately to let the PPPD handle them. + if (cyg_ppp_pppcheck(&ppp_tty) != 0) + return; + if( timo != NULL ) { cyg_tick_count_t trigger = timo->tv_sec*ppp_rtc_resolution.divisor;
