Patch/Bugfix for PPP on MC68360 (and MPC8xx)

Thomas Doerfler Thomas.Doerfler at imd-systems.de
Tue Mar 19 10:54:28 UTC 2002


Hi,

yesterday was networking day for me :)

I tried to set up the new PPP stack on a MC68360 board. The 
user's interface is great (!!!), tjank you, Mike!

But nevertheless the stack only worked with many packet drops. 
I finally found out, that the packets to be sent got corrupted 
very often.

The reason is the interface between the interrupt-driven 
MC68360 console driver and the PPP low level function 
"pppstart" in ppp_tty.c. The function pppstart passes data to 
be sent in the local character variables "c" and "cFrame". Due 
to the special behaviour of the MC68360 communication 
interfaces, the console driver function assumes that the 
content of these variables stays unchanged until data has been 
actually sent out to the physical interface. 

Here is a race condition. If the local variable storage 
(stack) is reused/overwritten, before the data to be sent has 
been read from memory, then data is corrupted.

Note, that this behaviour will almost only affect MC68360 or 
MPC8xx systems!

I applied a temporary patch, setting the variables to be 
"static", but I am not quite sure whether this is the final 
solution. 

Mike, do you have any better ideas?

By the way: The throughput for MC68360/MPC8xx systems would be 
greatly improved, if bigger chunks of the mbuf could be 
transfered in one block to the console driver. Is there any 
way to do this?

wkr,
	Thomas Doerfler.
--------------------------------------------
IMD Ingenieurbuero fuer Microcomputertechnik
Thomas Doerfler           Herbststrasse 8
D-82178 Puchheim          Germany
email:    Thomas.Doerfler at imd-systems.de
PGP public key available at: http://www.imd-
systems.de/pgp_key.htm


-------------- next part --------------
--- rtems-ss-20020205/c/src/libnetworking/net/ppp_tty.c	Thu Jan 31 22:40:47 2002
+++ /usr/local/projects/sandbox/zem40/rtems_patch/ppp_tty.c	Mon Mar 18 23:35:17 2002
@@ -558,12 +558,12 @@
  * Called at spltty or higher.
  */
 int
 pppstart(struct rtems_termios_tty *tp)
 {
-  char                c;
-  char                cFrame  = (char         )PPP_FLAG;
+  static char                c;
+  static char                cFrame  = (char         )PPP_FLAG;
   u_char              ioffset = (u_char       )0;
   struct mbuf        *m       = (struct mbuf *)0;
   struct ppp_softc   *sc      = tp->t_sc;
 
   /* ensure input is valid and we are busy */


More information about the users mailing list