summaryrefslogtreecommitdiffstats
path: root/c/src/libnetworking/pppd/sys-rtems.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2002-01-31 21:42:11 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2002-01-31 21:42:11 +0000
commit0286b9f6145f9664f6b0e196e24daee8be46b538 (patch)
tree5cdf87997238653f4083fe1c1326213040183044 /c/src/libnetworking/pppd/sys-rtems.c
parent2002-01-31 Ralf Corsepius <corsepiu@faw.uni-ulm.de> (diff)
downloadrtems-0286b9f6145f9664f6b0e196e24daee8be46b538.tar.bz2
2001-01-31 Mike Siers <mikes@poliac.com>
* Nice Update of PPPD support which eliminates the requiremetn that drivers be in the termios TASK_DRIVEN mode. Mike did significant testing and reports that it seems to be more stable and handle larger packets better. This patch replaces the termios tasks with more general pppd network driver tasks. The functions pppinput() and pppstart() get called from the interrupt service routine. * Makefile.am, configure.ac, net/Makefile.am, net/bpf.h, net/ethernet.h, net/if.c, net/if.h, net/if_arp.h, net/if_dl.h, net/if_ethersubr.c, net/if_llc.h, net/if_loop.c, net/if_ppp.h, net/if_pppvar.h, net/if_types.h, net/netisr.h, net/ppp-comp.h, net/ppp_defs.h, net/pppcompress.h, net/radix.c, net/radix.h, net/raw_cb.c, net/raw_cb.h, net/raw_usrreq.c, net/route.c, net/route.h, net/rtsock.c, pppd/Makefile.am, pppd/README, pppd/STATUS, pppd/auth.c, pppd/cbcp.c, pppd/ccp.c, pppd/ccp.h, pppd/chap.c, pppd/chap.h, pppd/chap_ms.c, pppd/chap_ms.h, pppd/chat.c, pppd/demand.c, pppd/fsm.c, pppd/fsm.h, pppd/ipcp.c, pppd/ipcp.h, pppd/ipxcp.c, pppd/ipxcp.h, pppd/lcp.c, pppd/lcp.h, pppd/magic.c, pppd/magic.h, pppd/options.c, pppd/patchlevel.h, pppd/pathnames.h, pppd/pppd.8, pppd/pppd.h, pppd/rtemsmain.c, pppd/rtemspppd.c, pppd/rtemspppd.h, pppd/sys-rtems.c, pppd/upap.c, pppd/upap.h, pppd/utils.c, pppd/example/README, pppd/example/netconfig.h, wrapup/Makefile.am: Modified. * net/bsd-comp.c, net/if_ppp.c, net/ppp-deflate.c, net/ppp.h, net/ppp_tty.c, net/pppcompress.c, net/zlib.c, net/zlib.h: New file. * modem/, modem/.cvsignore, modem/Makefile.am, modem/ppp.c, modem/ppp.h, modem/ppp_tty.c, modem/pppcompress.c: Subdirectory removed.
Diffstat (limited to 'c/src/libnetworking/pppd/sys-rtems.c')
-rw-r--r--c/src/libnetworking/pppd/sys-rtems.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/c/src/libnetworking/pppd/sys-rtems.c b/c/src/libnetworking/pppd/sys-rtems.c
index 90e0538ff1..dc8fa76538 100644
--- a/c/src/libnetworking/pppd/sys-rtems.c
+++ b/c/src/libnetworking/pppd/sys-rtems.c
@@ -95,12 +95,6 @@ static int dodefaultroute __P((u_int32_t, int));
static int get_ether_addr __P((u_int32_t, struct sockaddr_dl *));
-void
-sys_serialcallback(struct termios *tty, void *arg)
-{
- rtems_event_send(rtems_pppd_taskid, RTEMS_EVENT_31);
-}
-
/*
* sys_init - System-dependent initialization.
*/
@@ -187,6 +181,7 @@ int
establish_ppp(fd)
int fd;
{
+ int taskid = (int)rtems_pppd_taskid;
int pppdisc = PPPDISC;
int x;
@@ -206,6 +201,9 @@ establish_ppp(fd)
if (ioctl(fd, TIOCSETD, &pppdisc) < 0)
fatal("ioctl(TIOCSETD): %m");
+ /* set pppd taskid into the driver */
+ ioctl(fd, PPPIOCSTASK, &taskid);
+
if (!demand) {
/*
* Find out which interface we were given.
@@ -286,6 +284,11 @@ void
disestablish_ppp(fd)
int fd;
{
+ int taskid = (int)0;
+
+ /* clear pppd taskid from the driver */
+ ioctl(fd, PPPIOCSTASK, &taskid);
+
/* Reset non-blocking mode on fd. */
if (initfdflags != -1 && fcntl(fd, F_SETFL, initfdflags) < 0)
warn("Couldn't restore device fd flags: %m");
@@ -344,7 +347,6 @@ set_up_tty(fd, local)
int fd, local;
{
struct termios tios;
- struct ttywakeup wakeup;
if (tcgetattr(fd, &tios) < 0)
fatal("tcgetattr: %m");
@@ -403,11 +405,6 @@ set_up_tty(fd, local)
fatal("tcsetattr: %m");
}
- /* set up callback function */
- wakeup.sw_pfn = sys_serialcallback;
- wakeup.sw_arg = (void *)fd;
- ioctl(fd, RTEMS_IO_RCVWAKEUP, &wakeup);
-
restore_term = 1;
}
@@ -489,6 +486,7 @@ output(unit, p, len)
{
if (debug);
dbglog("sent %P", p, len);
+/* printf("sent packet [%d]\n", len); */
if (write(ttyfd, p, len) < 0) {
if (errno != EIO)
@@ -496,6 +494,15 @@ output(unit, p, len)
}
}
+void
+ppp_delay(void)
+{
+ rtems_interval ticks;
+
+ /* recommended delay to help negotiation */
+ ticks = 300000/rtems_bsdnet_microseconds_per_tick;
+ rtems_task_wake_after(ticks);
+}
/*
* wait_input - wait until there is data available,
@@ -525,10 +532,11 @@ read_packet(buf)
int len;
if ((len = read(ttyfd, buf, PPP_MTU + PPP_HDRLEN)) < 0) {
- if (errno == EWOULDBLOCK || errno == EINTR)
- return -1;
+ if (errno == EWOULDBLOCK || errno == EINTR) len = -1;
/*fatal("read: %m"); */
}
+
+/* printf("read packet [%d]\n", len); */
return len;
}
@@ -947,6 +955,7 @@ dodefaultroute(g, cmd)
u_int32_t g;
int cmd;
{
+ int status;
struct sockaddr_in address;
struct sockaddr_in netmask;
struct sockaddr_in gateway;