summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2002-03-21 15:01:32 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2002-03-21 15:01:32 +0000
commitfd55b7dbd5b33aa71195818c2d13eeaa1a27ca69 (patch)
treeb1d93adfdf06c34a4de346093d29e1d19d07b919
parentdf6348bb27cdab6ea9b6150b0cc65dfc11be3e35 (diff)
downloadrtems-fd55b7dbd5b33aa71195818c2d13eeaa1a27ca69.tar.bz2
2002-03-21 Ilya Alexeev <ilya@continuum.ru>
* net/if_ppp.c, net/ppp_tty.c: Initial preparations for multiple PPPD connections.
-rw-r--r--c/src/exec/libblock/ChangeLog5
-rw-r--r--c/src/exec/libnetworking/ChangeLog5
-rw-r--r--c/src/exec/libnetworking/net/if_ppp.c32
-rw-r--r--c/src/exec/libnetworking/net/ppp_tty.c22
-rw-r--r--c/src/libblock/ChangeLog5
-rw-r--r--c/src/libnetworking/ChangeLog5
-rw-r--r--c/src/libnetworking/net/if_ppp.c32
-rw-r--r--c/src/libnetworking/net/ppp_tty.c22
-rw-r--r--cpukit/libblock/ChangeLog5
-rw-r--r--cpukit/libnetworking/ChangeLog5
-rw-r--r--cpukit/libnetworking/net/if_ppp.c32
-rw-r--r--cpukit/libnetworking/net/ppp_tty.c22
12 files changed, 144 insertions, 48 deletions
diff --git a/c/src/exec/libblock/ChangeLog b/c/src/exec/libblock/ChangeLog
index dffc41ab88..325e8258d8 100644
--- a/c/src/exec/libblock/ChangeLog
+++ b/c/src/exec/libblock/ChangeLog
@@ -1,3 +1,8 @@
+2002-03-21 Ilya Alexeev <ilya@continuum.ru>
+
+ * net/if_ppp.c, net/ppp_tty.c: Initial preparations for multiple
+ PPPD connections.
+
2002-03-21 Alexander Kukuta <kam@oktet.ru>
* src/bdbuf.c (avl_insert, avl_remove): Reimplemented from scratch
diff --git a/c/src/exec/libnetworking/ChangeLog b/c/src/exec/libnetworking/ChangeLog
index 1a816f0d30..8305cf2bc0 100644
--- a/c/src/exec/libnetworking/ChangeLog
+++ b/c/src/exec/libnetworking/ChangeLog
@@ -1,3 +1,8 @@
+2002-03-21 Ilya Alexeev <ilya@continuum.ru>
+
+ * net/if_ppp.c, net/ppp_tty.c: Initial preparations for multiple
+ PPPD connections.
+
2001-03-20 Till Straumann <strauman@SLAC.Stanford.EDU>
* PR158
diff --git a/c/src/exec/libnetworking/net/if_ppp.c b/c/src/exec/libnetworking/net/if_ppp.c
index 9fd7dde6f3..bb90eac78a 100644
--- a/c/src/exec/libnetworking/net/if_ppp.c
+++ b/c/src/exec/libnetworking/net/if_ppp.c
@@ -378,7 +378,7 @@ static void ppp_init(struct ppp_softc *sc)
/* check to see if we need to start up daemons */
if ( sc->sc_rxtask == 0 ) {
/* start rx daemon task */
- status = rtems_task_create(rtems_build_name('R','x','P','0'), priority, 2048,
+ status = rtems_task_create(rtems_build_name('R','x','P','0'+sc->sc_if.if_unit), priority, 2048,
RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL,
&sc->sc_rxtask);
@@ -393,7 +393,7 @@ static void ppp_init(struct ppp_softc *sc)
}
/* start tx daemon task */
- status = rtems_task_create(rtems_build_name('T','x','P','0'), priority, 2048,
+ status = rtems_task_create(rtems_build_name('T','x','P','0'+sc->sc_if.if_unit), priority, 2048,
RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL,
&sc->sc_txtask);
@@ -409,7 +409,8 @@ static void ppp_init(struct ppp_softc *sc)
}
/* mark driver running and output inactive */
- sc->sc_if.if_flags |= IFF_RUNNING;
+ /* ilya: IFF_RUNNING flag will be marked after the IPCP goes up */
+/* sc->sc_if.if_flags |= IFF_RUNNING; */
}
/*
@@ -417,12 +418,25 @@ static void ppp_init(struct ppp_softc *sc)
*/
int rtems_ppp_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching)
{
- int i = (int)0;
+/* int i = (int)0; */
struct ppp_softc *sc;
-
- for (sc = ppp_softc; i < NPPP; sc++) {
- sc->sc_if.if_name = "ppp";
- sc->sc_if.if_unit = i++;
+ char *name;
+ int number;
+
+
+ number = rtems_bsdnet_parse_driver_name (config, &name);
+
+ if (!attaching || (number >= NPPP))
+ return 0;
+
+ sc = &ppp_softc[number];
+
+ if (sc->sc_if.if_name != NULL)
+ return 0; /* interface is already attached */
+
+/* for (sc = ppp_softc; i < NPPP; sc++) { */
+ sc->sc_if.if_name = name /*"ppp"*/;
+ sc->sc_if.if_unit = number /*i++*/;
sc->sc_if.if_mtu = PPP_MTU;
sc->sc_if.if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
sc->sc_if.if_type = IFT_PPP;
@@ -441,7 +455,7 @@ int rtems_ppp_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching)
#if NBPFILTER > 0
bpfattach(&sc->sc_bpf, &sc->sc_if, DLT_PPP, PPP_HDRLEN);
#endif
- }
+/* } */
return ( 1 );
}
diff --git a/c/src/exec/libnetworking/net/ppp_tty.c b/c/src/exec/libnetworking/net/ppp_tty.c
index cab3278f30..b655fd4f04 100644
--- a/c/src/exec/libnetworking/net/ppp_tty.c
+++ b/c/src/exec/libnetworking/net/ppp_tty.c
@@ -192,6 +192,7 @@ pppopen(struct rtems_termios_tty *tty)
int i;
register struct ppp_softc *sc;
struct mbuf *m = (struct mbuf *)0;
+ extern int termios_baud_to_number(int);
if (tty->t_line == PPPDISC) {
sc = (struct ppp_softc *)tty->t_sc;
@@ -238,7 +239,8 @@ pppopen(struct rtems_termios_tty *tty)
/* initialize values */
sc->sc_if.if_flags |= IFF_RUNNING;
- sc->sc_if.if_baudrate = 57600; /* FIX: get line speed from termios */
+ sc->sc_if.if_baudrate =
+ termios_baud_to_number(tty->termios.c_cflag & CBAUD);
tty->t_sc = (void *)sc;
@@ -421,7 +423,7 @@ pppwrite(struct rtems_termios_tty *tty, rtems_libio_rw_args_t *rw_args)
int
ppptioctl(struct rtems_termios_tty *tty, rtems_libio_ioctl_args_t *args)
{
- int i;
+/* int i; */
int error = RTEMS_SUCCESSFUL;
int cmd = args->command;
caddr_t data = args->buffer;
@@ -561,6 +563,7 @@ int
pppstart(struct rtems_termios_tty *tp)
{
char c;
+ char *sendBegin;
char cFrame = (char )PPP_FLAG;
u_char ioffset = (u_char )0;
struct mbuf *m = (struct mbuf *)0;
@@ -618,15 +621,20 @@ pppstart(struct rtems_termios_tty *tp)
/* set the escape flag */
sc->sc_outflag |= SC_TX_ESCAPE;
}
+ sendBegin = &c;
}
else {
- /* escape not needed - increment the offset */
- ioffset++;
+ /* escape not needed - increment the offset as much as possible */
+ while ((!ESCAPE_P(c)) && ((sc->sc_outoff + ioffset) < sc->sc_outlen)) {
+ ioffset++;
+ c = sc->sc_outbuf[sc->sc_outoff + ioffset];
+ }
+ sendBegin = &sc->sc_outbuf[sc->sc_outoff];
}
- /* write out the character and update the stats */
- (*tp->device.write)(tp->minor, &c, 1);
- sc->sc_stats.ppp_obytes++;
+ /* write out the character(s) and update the stats */
+ (*tp->device.write)(tp->minor, sendBegin, (ioffset > 0) ? ioffset : 1);
+ sc->sc_stats.ppp_obytes += (ioffset > 0) ? ioffset : 1;
sc->sc_outoff += ioffset;
}
}
diff --git a/c/src/libblock/ChangeLog b/c/src/libblock/ChangeLog
index dffc41ab88..325e8258d8 100644
--- a/c/src/libblock/ChangeLog
+++ b/c/src/libblock/ChangeLog
@@ -1,3 +1,8 @@
+2002-03-21 Ilya Alexeev <ilya@continuum.ru>
+
+ * net/if_ppp.c, net/ppp_tty.c: Initial preparations for multiple
+ PPPD connections.
+
2002-03-21 Alexander Kukuta <kam@oktet.ru>
* src/bdbuf.c (avl_insert, avl_remove): Reimplemented from scratch
diff --git a/c/src/libnetworking/ChangeLog b/c/src/libnetworking/ChangeLog
index 1a816f0d30..8305cf2bc0 100644
--- a/c/src/libnetworking/ChangeLog
+++ b/c/src/libnetworking/ChangeLog
@@ -1,3 +1,8 @@
+2002-03-21 Ilya Alexeev <ilya@continuum.ru>
+
+ * net/if_ppp.c, net/ppp_tty.c: Initial preparations for multiple
+ PPPD connections.
+
2001-03-20 Till Straumann <strauman@SLAC.Stanford.EDU>
* PR158
diff --git a/c/src/libnetworking/net/if_ppp.c b/c/src/libnetworking/net/if_ppp.c
index 9fd7dde6f3..bb90eac78a 100644
--- a/c/src/libnetworking/net/if_ppp.c
+++ b/c/src/libnetworking/net/if_ppp.c
@@ -378,7 +378,7 @@ static void ppp_init(struct ppp_softc *sc)
/* check to see if we need to start up daemons */
if ( sc->sc_rxtask == 0 ) {
/* start rx daemon task */
- status = rtems_task_create(rtems_build_name('R','x','P','0'), priority, 2048,
+ status = rtems_task_create(rtems_build_name('R','x','P','0'+sc->sc_if.if_unit), priority, 2048,
RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL,
&sc->sc_rxtask);
@@ -393,7 +393,7 @@ static void ppp_init(struct ppp_softc *sc)
}
/* start tx daemon task */
- status = rtems_task_create(rtems_build_name('T','x','P','0'), priority, 2048,
+ status = rtems_task_create(rtems_build_name('T','x','P','0'+sc->sc_if.if_unit), priority, 2048,
RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL,
&sc->sc_txtask);
@@ -409,7 +409,8 @@ static void ppp_init(struct ppp_softc *sc)
}
/* mark driver running and output inactive */
- sc->sc_if.if_flags |= IFF_RUNNING;
+ /* ilya: IFF_RUNNING flag will be marked after the IPCP goes up */
+/* sc->sc_if.if_flags |= IFF_RUNNING; */
}
/*
@@ -417,12 +418,25 @@ static void ppp_init(struct ppp_softc *sc)
*/
int rtems_ppp_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching)
{
- int i = (int)0;
+/* int i = (int)0; */
struct ppp_softc *sc;
-
- for (sc = ppp_softc; i < NPPP; sc++) {
- sc->sc_if.if_name = "ppp";
- sc->sc_if.if_unit = i++;
+ char *name;
+ int number;
+
+
+ number = rtems_bsdnet_parse_driver_name (config, &name);
+
+ if (!attaching || (number >= NPPP))
+ return 0;
+
+ sc = &ppp_softc[number];
+
+ if (sc->sc_if.if_name != NULL)
+ return 0; /* interface is already attached */
+
+/* for (sc = ppp_softc; i < NPPP; sc++) { */
+ sc->sc_if.if_name = name /*"ppp"*/;
+ sc->sc_if.if_unit = number /*i++*/;
sc->sc_if.if_mtu = PPP_MTU;
sc->sc_if.if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
sc->sc_if.if_type = IFT_PPP;
@@ -441,7 +455,7 @@ int rtems_ppp_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching)
#if NBPFILTER > 0
bpfattach(&sc->sc_bpf, &sc->sc_if, DLT_PPP, PPP_HDRLEN);
#endif
- }
+/* } */
return ( 1 );
}
diff --git a/c/src/libnetworking/net/ppp_tty.c b/c/src/libnetworking/net/ppp_tty.c
index cab3278f30..b655fd4f04 100644
--- a/c/src/libnetworking/net/ppp_tty.c
+++ b/c/src/libnetworking/net/ppp_tty.c
@@ -192,6 +192,7 @@ pppopen(struct rtems_termios_tty *tty)
int i;
register struct ppp_softc *sc;
struct mbuf *m = (struct mbuf *)0;
+ extern int termios_baud_to_number(int);
if (tty->t_line == PPPDISC) {
sc = (struct ppp_softc *)tty->t_sc;
@@ -238,7 +239,8 @@ pppopen(struct rtems_termios_tty *tty)
/* initialize values */
sc->sc_if.if_flags |= IFF_RUNNING;
- sc->sc_if.if_baudrate = 57600; /* FIX: get line speed from termios */
+ sc->sc_if.if_baudrate =
+ termios_baud_to_number(tty->termios.c_cflag & CBAUD);
tty->t_sc = (void *)sc;
@@ -421,7 +423,7 @@ pppwrite(struct rtems_termios_tty *tty, rtems_libio_rw_args_t *rw_args)
int
ppptioctl(struct rtems_termios_tty *tty, rtems_libio_ioctl_args_t *args)
{
- int i;
+/* int i; */
int error = RTEMS_SUCCESSFUL;
int cmd = args->command;
caddr_t data = args->buffer;
@@ -561,6 +563,7 @@ int
pppstart(struct rtems_termios_tty *tp)
{
char c;
+ char *sendBegin;
char cFrame = (char )PPP_FLAG;
u_char ioffset = (u_char )0;
struct mbuf *m = (struct mbuf *)0;
@@ -618,15 +621,20 @@ pppstart(struct rtems_termios_tty *tp)
/* set the escape flag */
sc->sc_outflag |= SC_TX_ESCAPE;
}
+ sendBegin = &c;
}
else {
- /* escape not needed - increment the offset */
- ioffset++;
+ /* escape not needed - increment the offset as much as possible */
+ while ((!ESCAPE_P(c)) && ((sc->sc_outoff + ioffset) < sc->sc_outlen)) {
+ ioffset++;
+ c = sc->sc_outbuf[sc->sc_outoff + ioffset];
+ }
+ sendBegin = &sc->sc_outbuf[sc->sc_outoff];
}
- /* write out the character and update the stats */
- (*tp->device.write)(tp->minor, &c, 1);
- sc->sc_stats.ppp_obytes++;
+ /* write out the character(s) and update the stats */
+ (*tp->device.write)(tp->minor, sendBegin, (ioffset > 0) ? ioffset : 1);
+ sc->sc_stats.ppp_obytes += (ioffset > 0) ? ioffset : 1;
sc->sc_outoff += ioffset;
}
}
diff --git a/cpukit/libblock/ChangeLog b/cpukit/libblock/ChangeLog
index dffc41ab88..325e8258d8 100644
--- a/cpukit/libblock/ChangeLog
+++ b/cpukit/libblock/ChangeLog
@@ -1,3 +1,8 @@
+2002-03-21 Ilya Alexeev <ilya@continuum.ru>
+
+ * net/if_ppp.c, net/ppp_tty.c: Initial preparations for multiple
+ PPPD connections.
+
2002-03-21 Alexander Kukuta <kam@oktet.ru>
* src/bdbuf.c (avl_insert, avl_remove): Reimplemented from scratch
diff --git a/cpukit/libnetworking/ChangeLog b/cpukit/libnetworking/ChangeLog
index 1a816f0d30..8305cf2bc0 100644
--- a/cpukit/libnetworking/ChangeLog
+++ b/cpukit/libnetworking/ChangeLog
@@ -1,3 +1,8 @@
+2002-03-21 Ilya Alexeev <ilya@continuum.ru>
+
+ * net/if_ppp.c, net/ppp_tty.c: Initial preparations for multiple
+ PPPD connections.
+
2001-03-20 Till Straumann <strauman@SLAC.Stanford.EDU>
* PR158
diff --git a/cpukit/libnetworking/net/if_ppp.c b/cpukit/libnetworking/net/if_ppp.c
index 9fd7dde6f3..bb90eac78a 100644
--- a/cpukit/libnetworking/net/if_ppp.c
+++ b/cpukit/libnetworking/net/if_ppp.c
@@ -378,7 +378,7 @@ static void ppp_init(struct ppp_softc *sc)
/* check to see if we need to start up daemons */
if ( sc->sc_rxtask == 0 ) {
/* start rx daemon task */
- status = rtems_task_create(rtems_build_name('R','x','P','0'), priority, 2048,
+ status = rtems_task_create(rtems_build_name('R','x','P','0'+sc->sc_if.if_unit), priority, 2048,
RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL,
&sc->sc_rxtask);
@@ -393,7 +393,7 @@ static void ppp_init(struct ppp_softc *sc)
}
/* start tx daemon task */
- status = rtems_task_create(rtems_build_name('T','x','P','0'), priority, 2048,
+ status = rtems_task_create(rtems_build_name('T','x','P','0'+sc->sc_if.if_unit), priority, 2048,
RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL,
&sc->sc_txtask);
@@ -409,7 +409,8 @@ static void ppp_init(struct ppp_softc *sc)
}
/* mark driver running and output inactive */
- sc->sc_if.if_flags |= IFF_RUNNING;
+ /* ilya: IFF_RUNNING flag will be marked after the IPCP goes up */
+/* sc->sc_if.if_flags |= IFF_RUNNING; */
}
/*
@@ -417,12 +418,25 @@ static void ppp_init(struct ppp_softc *sc)
*/
int rtems_ppp_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching)
{
- int i = (int)0;
+/* int i = (int)0; */
struct ppp_softc *sc;
-
- for (sc = ppp_softc; i < NPPP; sc++) {
- sc->sc_if.if_name = "ppp";
- sc->sc_if.if_unit = i++;
+ char *name;
+ int number;
+
+
+ number = rtems_bsdnet_parse_driver_name (config, &name);
+
+ if (!attaching || (number >= NPPP))
+ return 0;
+
+ sc = &ppp_softc[number];
+
+ if (sc->sc_if.if_name != NULL)
+ return 0; /* interface is already attached */
+
+/* for (sc = ppp_softc; i < NPPP; sc++) { */
+ sc->sc_if.if_name = name /*"ppp"*/;
+ sc->sc_if.if_unit = number /*i++*/;
sc->sc_if.if_mtu = PPP_MTU;
sc->sc_if.if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
sc->sc_if.if_type = IFT_PPP;
@@ -441,7 +455,7 @@ int rtems_ppp_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching)
#if NBPFILTER > 0
bpfattach(&sc->sc_bpf, &sc->sc_if, DLT_PPP, PPP_HDRLEN);
#endif
- }
+/* } */
return ( 1 );
}
diff --git a/cpukit/libnetworking/net/ppp_tty.c b/cpukit/libnetworking/net/ppp_tty.c
index cab3278f30..b655fd4f04 100644
--- a/cpukit/libnetworking/net/ppp_tty.c
+++ b/cpukit/libnetworking/net/ppp_tty.c
@@ -192,6 +192,7 @@ pppopen(struct rtems_termios_tty *tty)
int i;
register struct ppp_softc *sc;
struct mbuf *m = (struct mbuf *)0;
+ extern int termios_baud_to_number(int);
if (tty->t_line == PPPDISC) {
sc = (struct ppp_softc *)tty->t_sc;
@@ -238,7 +239,8 @@ pppopen(struct rtems_termios_tty *tty)
/* initialize values */
sc->sc_if.if_flags |= IFF_RUNNING;
- sc->sc_if.if_baudrate = 57600; /* FIX: get line speed from termios */
+ sc->sc_if.if_baudrate =
+ termios_baud_to_number(tty->termios.c_cflag & CBAUD);
tty->t_sc = (void *)sc;
@@ -421,7 +423,7 @@ pppwrite(struct rtems_termios_tty *tty, rtems_libio_rw_args_t *rw_args)
int
ppptioctl(struct rtems_termios_tty *tty, rtems_libio_ioctl_args_t *args)
{
- int i;
+/* int i; */
int error = RTEMS_SUCCESSFUL;
int cmd = args->command;
caddr_t data = args->buffer;
@@ -561,6 +563,7 @@ int
pppstart(struct rtems_termios_tty *tp)
{
char c;
+ char *sendBegin;
char cFrame = (char )PPP_FLAG;
u_char ioffset = (u_char )0;
struct mbuf *m = (struct mbuf *)0;
@@ -618,15 +621,20 @@ pppstart(struct rtems_termios_tty *tp)
/* set the escape flag */
sc->sc_outflag |= SC_TX_ESCAPE;
}
+ sendBegin = &c;
}
else {
- /* escape not needed - increment the offset */
- ioffset++;
+ /* escape not needed - increment the offset as much as possible */
+ while ((!ESCAPE_P(c)) && ((sc->sc_outoff + ioffset) < sc->sc_outlen)) {
+ ioffset++;
+ c = sc->sc_outbuf[sc->sc_outoff + ioffset];
+ }
+ sendBegin = &sc->sc_outbuf[sc->sc_outoff];
}
- /* write out the character and update the stats */
- (*tp->device.write)(tp->minor, &c, 1);
- sc->sc_stats.ppp_obytes++;
+ /* write out the character(s) and update the stats */
+ (*tp->device.write)(tp->minor, sendBegin, (ioffset > 0) ? ioffset : 1);
+ sc->sc_stats.ppp_obytes += (ioffset > 0) ? ioffset : 1;
sc->sc_outoff += ioffset;
}
}