Permalink
Browse files

[LIBS] netstack: Enable core locking in lwIP for improved performance

By default, lwIP uses "tcpip_thread" thread for serializing Rx, Tx and
various other requests. This makes lwIP multi-threading safe but comes
with a price of reduced performance.

We also have experimental "core locking" options in lwIP which if enabled
causes lwIP to use a global mutex lock for serializing Rx, Tx and other
requests. It is also known fact that "core locking" does improve lwIP
performance but it is still experimental.
(Refer, https://lists.gnu.org/archive/html/lwip-users/2011-07/msg00068.html)

This patch enables "core locking" for lwIP.

Signed-off-by: Anup Patel <anup@brainfault.org>
  • Loading branch information...
1 parent 003ba23 commit 258cffd032f5d18e7d122e079bc897ace37a482b @avpatel avpatel committed Feb 13, 2014
Showing with 11 additions and 1 deletion.
  1. +11 −1 libs/netstack/lwip/port/include/lwipopts.h
@@ -348,7 +348,6 @@
* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. The default is
* designed to accomodate single full size TCP frame in one pbuf, including
* TCP_MSS, IP header, and link header.
-*
*/
#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN)
@@ -369,6 +368,17 @@
*/
/**
+ * LWIP_TCPIP_CORE_LOCKING==1: (EXPERIMENTAL!)
+ * Enable global semaphore to lock the stack
+ */
+#define LWIP_TCPIP_CORE_LOCKING 1
+
+/**
+ * LWIP_TCPIP_CORE_LOCKING_INPUT==1: (EXPERIMENTAL!)
+ */
+#define LWIP_TCPIP_CORE_LOCKING_INPUT 1
+
+/**
* LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
*/
#define LWIP_NETCONN 1

0 comments on commit 258cffd

Please sign in to comment.