forked from Imagelibrary/rtems
2004-01-30 Wilfried Busalski <w.busalski@lancier-monitoring.de>
PR pppd/564 * libnetworking/net/if_ppp.c, libnetworking/net/if_pppvar.h, libnetworking/net/ppp_tty.c: ppp0 Interface lose packets if the system use a slow baudrate for the modem or the tcp/ip-packet is fragmented.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2004-01-30 Wilfried Busalski <w.busalski@lancier-monitoring.de>
|
||||
|
||||
PR pppd/564
|
||||
* libnetworking/net/if_ppp.c, libnetworking/net/if_pppvar.h,
|
||||
libnetworking/net/ppp_tty.c: ppp0 Interface lose packets if the
|
||||
system use a slow baudrate for the modem or the tcp/ip-packet is
|
||||
fragmented.
|
||||
|
||||
2004-01-30 Joel Sherrill <joel@OARcorp.com>
|
||||
|
||||
* ChangeLog, rtems/Makefile.am, rtems/include/rtems/rtems/support.h:
|
||||
|
||||
@@ -250,6 +250,8 @@ static rtems_task ppp_txdaemon(rtems_task_argument arg)
|
||||
struct mbuf *mf;
|
||||
struct mbuf *m;
|
||||
struct rtems_termios_tty *tp;
|
||||
|
||||
int frag;
|
||||
|
||||
/* enter processing loop */
|
||||
while ( 1 ) {
|
||||
@@ -258,7 +260,9 @@ static rtems_task ppp_txdaemon(rtems_task_argument arg)
|
||||
if ( events & TX_TRANSMIT ) {
|
||||
/* received event from interrupt handler - free current mbuf */
|
||||
rtems_bsdnet_semaphore_obtain();
|
||||
|
||||
m_freem(sc->sc_outm);
|
||||
|
||||
rtems_bsdnet_semaphore_release();
|
||||
|
||||
/* chain is done - clear the values */
|
||||
@@ -267,7 +271,7 @@ static rtems_task ppp_txdaemon(rtems_task_argument arg)
|
||||
|
||||
/* now set flag to fake receive of TX_PACKET event */
|
||||
/* this will check to see if we have any pending packets */
|
||||
events |= TX_PACKET;
|
||||
events |= TX_PACKET;
|
||||
}
|
||||
|
||||
/* received event from pppasyncstart */
|
||||
@@ -294,6 +298,7 @@ static rtems_task ppp_txdaemon(rtems_task_argument arg)
|
||||
if ( iprocess ) {
|
||||
/* clear process flag */
|
||||
iprocess = (int)0;
|
||||
frag=0;
|
||||
|
||||
/* initialize output values */
|
||||
sc->sc_outfcs = PPP_INITFCS;
|
||||
@@ -301,23 +306,37 @@ static rtems_task ppp_txdaemon(rtems_task_argument arg)
|
||||
sc->sc_outlen = (short )0;
|
||||
sc->sc_outoff = (short )0;
|
||||
sc->sc_outfcslen = (short )0;
|
||||
|
||||
/* printf("Start Transmit Packet..\n"); */
|
||||
|
||||
/* loop over all mbufs in chain */
|
||||
mf = NULL;
|
||||
mp = NULL;
|
||||
m = sc->sc_outm;
|
||||
|
||||
sc->sc_outmc = m;
|
||||
sc->sc_outlen = m->m_len;
|
||||
sc->sc_outbuf = mtod(m, u_char *);
|
||||
|
||||
while (( m != (struct mbuf *)0 ) && ( m->m_len > 0 )) {
|
||||
/* check to see if first mbuf value has been set */
|
||||
if ( sc->sc_outmc == (struct mbuf *)0 ) {
|
||||
/* set values to start with this mbuf */
|
||||
sc->sc_outmc = m;
|
||||
sc->sc_outlen = m->m_len;
|
||||
sc->sc_outbuf = mtod(m, u_char *);
|
||||
}
|
||||
frag++;
|
||||
|
||||
/* update the FCS value and then check next packet length */
|
||||
sc->sc_outfcs = pppfcs(sc->sc_outfcs, mtod(m, u_char *), m->m_len);
|
||||
|
||||
if(m->m_len){
|
||||
sc->sc_outfcs = pppfcs(sc->sc_outfcs, mtod(m, u_char *), m->m_len);
|
||||
}
|
||||
|
||||
if(( m->m_next != NULL ) && ( m->m_next->m_len == 0 )) {
|
||||
if(mf){
|
||||
printf(" if_ppp.c : MBUF Error !!!!\n");
|
||||
}
|
||||
else{
|
||||
mf = m->m_next;
|
||||
m->m_next = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LALL_X
|
||||
/* check next packet to see if it is empty */
|
||||
while (( m->m_next != NULL ) && ( m->m_next->m_len == 0 )) {
|
||||
/* next mbuf is zero length */
|
||||
@@ -337,7 +356,7 @@ static rtems_task ppp_txdaemon(rtems_task_argument arg)
|
||||
m->m_next = m->m_next->m_next;
|
||||
mp->m_next = NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* move to next packet */
|
||||
m = m->m_next;
|
||||
}
|
||||
@@ -351,7 +370,7 @@ static rtems_task ppp_txdaemon(rtems_task_argument arg)
|
||||
microtime(&sc->sc_if.if_lastchange);
|
||||
|
||||
/* write out frame byte to start the transmission */
|
||||
sc->sc_outchar = (u_char)PPP_FLAG;
|
||||
sc->sc_outchar = (u_char)PPP_FLAG;
|
||||
(*tp->device.write)(tp->minor, &sc->sc_outchar, 1);
|
||||
}
|
||||
|
||||
@@ -361,7 +380,7 @@ static rtems_task ppp_txdaemon(rtems_task_argument arg)
|
||||
rtems_bsdnet_semaphore_obtain();
|
||||
m_freem(mf);
|
||||
rtems_bsdnet_semaphore_release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id$ */
|
||||
/* $Id$ */
|
||||
/*
|
||||
* if_pppvar.h - private structures and declarations for PPP.
|
||||
*
|
||||
@@ -137,4 +137,5 @@ void pppallocmbuf __P((struct ppp_softc *sc, struct mbuf **mp));
|
||||
#define SC_TX_BUSY 0x0001
|
||||
#define SC_TX_FCS 0x0002
|
||||
#define SC_TX_ESCAPE 0x0004
|
||||
#define SC_TX_LASTCHAR 0x0008
|
||||
#define SC_TX_PENDING 0x0010
|
||||
|
||||
@@ -570,6 +570,14 @@ pppstart(struct rtems_termios_tty *tp)
|
||||
/* ensure input is valid and we are busy */
|
||||
if (( sc != NULL ) && ( sc->sc_outflag & SC_TX_BUSY )) {
|
||||
/* check to see if we need to get the next buffer */
|
||||
|
||||
/* Ready with PPP_FLAG Character ? */
|
||||
if(sc->sc_outflag & SC_TX_LASTCHAR){
|
||||
sc->sc_outflag &= ~(SC_TX_BUSY | SC_TX_FCS | SC_TX_LASTCHAR);
|
||||
rtems_event_send(sc->sc_txtask, TX_TRANSMIT); /* Ready for the next Packet */
|
||||
return(0);
|
||||
}
|
||||
|
||||
if ( sc->sc_outoff >= sc->sc_outlen ) {
|
||||
/* loop to get next non-zero length buffer */
|
||||
if ( sc->sc_outmc != NULL ) {
|
||||
@@ -593,10 +601,11 @@ pppstart(struct rtems_termios_tty *tp)
|
||||
}
|
||||
else {
|
||||
/* done with this packet */
|
||||
sc->sc_outflag &= ~SC_TX_BUSY;
|
||||
sc->sc_outchar = (u_char)PPP_FLAG;
|
||||
sc->sc_outflag |= SC_TX_LASTCHAR;
|
||||
sc->sc_outflag &=~(SC_TX_FCS);
|
||||
sc->sc_outchar = (u_char)PPP_FLAG;
|
||||
(*tp->device.write)(tp->minor, &sc->sc_outchar, 1);
|
||||
rtems_event_send(sc->sc_txtask, TX_TRANSMIT);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user