1. Reduce the size of the heap memory 2. Change the TCP segment size 3. Disable UDP + DHCP + DNS 4. Change the configuration of the TCP/IP thread

Dependents:   EthernetInterface

Fork of lwip by mbed official

Files at this revision

API Documentation at this revision

Comitter:
donatien
Date:
Fri Jun 22 15:08:59 2012 +0000
Parent:
3:9a63dd787415
Child:
5:89eb903836af
Commit message:
Put PPP Buffers in AHBSRAM1; pppOverSerialOpen() thread leak removed; Does not fail if remote end does not advertise its IP address

Changed in this revision

netif/ppp/ipcp.c Show annotated file Show diff for this revision Revisions of this file
netif/ppp/lcp.c Show annotated file Show diff for this revision Revisions of this file
netif/ppp/ppp.c Show annotated file Show diff for this revision Revisions of this file
--- a/netif/ppp/ipcp.c	Fri Jun 22 13:39:39 2012 +0000
+++ b/netif/ppp/ipcp.c	Fri Jun 22 15:08:59 2012 +0000
@@ -1235,9 +1235,13 @@
   }
 
   if (ho->hisaddr == 0) {
+#if 0
     IPCPDEBUG(LOG_ERR, ("Could not determine remote IP address\n"));
     ipcp_close(f->unit, "Could not determine remote IP address");
     return;
+#else //Kludge
+    ho->hisaddr = 0; //Set remote IP to 0.0.0.0, this is needed as most 3g providers do not advertise the remote IP to the user
+#endif
   }
   if (go->ouraddr == 0) {
     IPCPDEBUG(LOG_ERR, ("Could not determine local IP address\n"));
--- a/netif/ppp/lcp.c	Fri Jun 22 13:39:39 2012 +0000
+++ b/netif/ppp/lcp.c	Fri Jun 22 15:08:59 2012 +0000
@@ -107,7 +107,7 @@
 static u32_t lcp_echo_timer_running = 0;                /* TRUE if a timer is running */
 
 /* @todo: do we really need such a large buffer? The typical 1500 bytes seem too much. */
-static u_char nak_buffer[PPP_MRU]; /* where we construct a nak packet */ 
+static u_char nak_buffer[PPP_MRU] __attribute((section("AHBSRAM1"))); /* where we construct a nak packet */
 
 /*
  * Callbacks for fsm code.  (CI = Configuration Information)
--- a/netif/ppp/ppp.c	Fri Jun 22 13:39:39 2012 +0000
+++ b/netif/ppp/ppp.c	Fri Jun 22 15:08:59 2012 +0000
@@ -249,7 +249,9 @@
 /******************************/
 u_long subnetMask;
 
-static PPPControl pppControl[NUM_PPP]; /* The PPP interface control blocks. */
+static PPPControl pppControl[NUM_PPP] __attribute((section("AHBSRAM1"))); /* The PPP interface control blocks. */
+
+sys_mbox_t pppMbox; //Used to signal PPP thread that a PPP session begins
 
 /*
  * PPP Data Link Layer "protocol" table.
@@ -279,7 +281,7 @@
  * Buffers for outgoing packets.  This must be accessed only from the appropriate
  * PPP task so that it doesn't need to be protected to avoid collisions.
  */
-u_char outpacket_buf[NUM_PPP][PPP_MRU+PPP_HDRLEN];
+u_char outpacket_buf[NUM_PPP][PPP_MRU+PPP_HDRLEN] __attribute((section("AHBSRAM1")));
 
 
 /*****************************/
@@ -448,6 +450,9 @@
       (*protp->init)(i);
     }
   }
+
+  sys_mbox_new(&pppMbox, 1);
+  sys_thread_new(PPP_THREAD_NAME, pppInputThread, (void*)NULL, PPP_THREAD_STACKSIZE, PPP_THREAD_PRIO); //Create PPP thread here
 }
 
 void
@@ -573,7 +578,7 @@
     PPPDEBUG(LOG_INFO, ("pppOverSerialOpen: unit %d: Connecting\n", pd));
     pppStart(pd);
 #if PPP_INPROC_OWNTHREAD
-    sys_thread_new(PPP_THREAD_NAME, pppInputThread, (void*)&pc->rx, PPP_THREAD_STACKSIZE, PPP_THREAD_PRIO);
+    sys_mbox_post(&pppMbox, (void*)&pc->rx);
 #endif
   }
 
@@ -1508,6 +1513,10 @@
   int count;
   PPPControlRx *pcrx = arg;
 
+  do
+  {
+  sys_arch_mbox_fetch(&pppMbox, (void**)&pcrx, 0); //Wait indefinitely
+
   while (lcp_phase[pcrx->pd] != PHASE_DEAD) {
     count = sio_read(pcrx->fd, pcrx->rxbuf, PPPOS_RX_BUFSIZE);
     if(count > 0) {
@@ -1517,6 +1526,7 @@
       sys_msleep(1);
     }
   }
+  } while(1); //Never terminates
 }
 #endif /* PPPOS_SUPPORT && PPP_INPROC_OWNTHREAD */