]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lwip.git/commitdiff
Added define LWIP_TCPIP_CORE_LOCKING_INPUT that lets tcpip_input omit the thread...
authorgoldsimon <goldsimon>
Sun, 21 Feb 2010 12:38:08 +0000 (12:38 +0000)
committergoldsimon <goldsimon>
Sun, 21 Feb 2010 12:38:08 +0000 (12:38 +0000)
src/api/tcpip.c
src/include/lwip/opt.h

index 75142bbb4c01799da62bd8ba09e42309ed36f86e..e45d86cb8087c8268aaff9a3cd38d977cf010090 100644 (file)
@@ -94,6 +94,7 @@ tcpip_thread(void *arg)
       break;
 #endif /* LWIP_NETCONN */
 
+#if LWIP_TCPIP_CORE_LOCKING_INPUT
     case TCPIP_MSG_INPKT:
       LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: PACKET %p\n", (void *)msg));
 #if LWIP_ETHERNET
@@ -101,10 +102,12 @@ tcpip_thread(void *arg)
         ethernet_input(msg->msg.inp.p, msg->msg.inp.netif);
       } else
 #endif /* LWIP_ETHERNET */
-      { ip_input(msg->msg.inp.p, msg->msg.inp.netif);
+      {
+        ip_input(msg->msg.inp.p, msg->msg.inp.netif);
       }
       memp_free(MEMP_TCPIP_MSG_INPKT, msg);
       break;
+#endif /* LWIP_TCPIP_CORE_LOCKING_INPUT */
 
 #if LWIP_NETIF_API
     case TCPIP_MSG_NETIFAPI:
@@ -131,6 +134,8 @@ tcpip_thread(void *arg)
       break;
 
     default:
+      LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: invalid message: %d\n", msg->type));
+      LWIP_ASSERT("tcpip_thread: invalid message", 0);
       break;
     }
   }
@@ -147,6 +152,21 @@ tcpip_thread(void *arg)
 err_t
 tcpip_input(struct pbuf *p, struct netif *inp)
 {
+#if LWIP_TCPIP_CORE_LOCKING_INPUT
+  err_t ret;
+  LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_input: PACKET %p/%p\n", (void *)p, (void *)inp));
+  LOCK_TCPIP_CORE();
+#if LWIP_ETHERNET
+  if (inp->flags & (NETIF_FLAG_ETHARP | NETIF_FLAG_ETHERNET)) {
+    ret = ethernet_input(p, inp);
+  } else
+#endif /* LWIP_ETHERNET */
+  {
+    ret = ip_input(p, inp);
+  }
+  UNLOCK_TCPIP_CORE();
+  return ret;
+#else /* LWIP_TCPIP_CORE_LOCKING_INPUT */
   struct tcpip_msg *msg;
 
   if (sys_mbox_valid(&mbox)) {
@@ -165,6 +185,7 @@ tcpip_input(struct pbuf *p, struct netif *inp)
     return ERR_OK;
   }
   return ERR_VAL;
+#endif /* LWIP_TCPIP_CORE_LOCKING_INPUT */
 }
 
 /**
index 444fe0abd1a070bae0bf2869419b7be4070a2efc..7bb9aa22abe76ffcb888a9a8393ba2e3a594f6cd 100644 (file)
 #define LWIP_TCPIP_CORE_LOCKING         0
 #endif
 
+/**
+ * LWIP_TCPIP_CORE_LOCKING_INPUT: (EXPERIMENTAL!)
+ * Don't use it if you're not an active lwIP project member
+ */
+#ifndef LWIP_TCPIP_CORE_LOCKING_INPUT
+#define LWIP_TCPIP_CORE_LOCKING_INPUT   0
+#endif
+
 /**
  * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
  */