lwip update
* The mdns responder has been reworked to lower stack and memory usage. This is a variation on the upstream code, it use malloc whereas the upstream code uses pools. The high stack usage of the mdns responder was problem for esp-open-rtos, so we might have to maintain the differences for now. * Improved lwip core locking, and lock checking. Upstream improvements, that need some added support from esp-open-rtos specific code. More core lock is performed when calling from the esp-open-rtos code now, so a little safer. The checking is not enforced, but projects might see warning messages and might want to look into them. * The esp-open-rtos lwip support has been sync'ed with the new freertos port included with lwip. There are still some minor differences. * A few lwip timer bugs have been resolved. This might help resolve some issues. * Plus it picks up all the other upstream fixes and improvements. * The default lwip stack has been lowered from 768 words to 480 words, due to the reduced stack usage by the mdns responder.
This commit is contained in:
parent
5f8b3d43c7
commit
3c81f7d587
12 changed files with 345 additions and 185 deletions
|
|
@ -87,14 +87,9 @@ typedef int sys_prot_t;
|
|||
} while(0)
|
||||
#define LWIP_PLATFORM_ASSERT(x) do { printf("Assertion \"%s\" failed at line %d in %s\n", \
|
||||
x, __LINE__, __FILE__); abort(); } while(0)
|
||||
|
||||
#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
|
||||
printf("Assertion \"%s\" failed at line %d in %s\n", message, __LINE__, __FILE__); \
|
||||
handler;} } while(0)
|
||||
#else
|
||||
#define LWIP_PLATFORM_DIAG(x)
|
||||
#define LWIP_PLATFORM_ASSERT(x)
|
||||
#define LWIP_ERROR(m,e,h)
|
||||
#endif
|
||||
|
||||
#define LWIP_PLATFORM_BYTESWAP 1
|
||||
|
|
@ -104,4 +99,7 @@ typedef int sys_prot_t;
|
|||
|
||||
#define LWIP_RAND() hwrand()
|
||||
|
||||
/* Newlib includes this definition so use it. */
|
||||
#define lwip_strnstr(buffer, token, n) strnstr(buffer, token, n)
|
||||
|
||||
#endif /* __ARCH_CC_H__ */
|
||||
|
|
|
|||
|
|
@ -1,58 +1,62 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __ARCH_SYS_ARCH_H__
|
||||
#define __ARCH_SYS_ARCH_H__
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
#include "semphr.h"
|
||||
|
||||
/* MBOX primitives */
|
||||
|
||||
#define SYS_MBOX_NULL ( ( QueueHandle_t ) NULL )
|
||||
#define SYS_SEM_NULL ( ( SemaphoreHandle_t ) NULL )
|
||||
#define SYS_DEFAULT_THREAD_STACK_DEPTH configMINIMAL_STACK_SIZE
|
||||
|
||||
typedef SemaphoreHandle_t sys_sem_t;
|
||||
typedef SemaphoreHandle_t sys_mutex_t;
|
||||
typedef QueueHandle_t sys_mbox_t;
|
||||
typedef TaskHandle_t sys_thread_t;
|
||||
|
||||
#define sys_mbox_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE )
|
||||
#define sys_mbox_set_invalid( x ) ( ( *x ) = NULL )
|
||||
#define sys_sem_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE )
|
||||
#define sys_sem_set_invalid( x ) ( ( *x ) = NULL )
|
||||
|
||||
|
||||
#endif /* __ARCH_SYS_ARCH_H__ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __ARCH_SYS_ARCH_H__
|
||||
#define __ARCH_SYS_ARCH_H__
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
#include "semphr.h"
|
||||
|
||||
/* MBOX primitives */
|
||||
|
||||
#define SYS_MBOX_NULL ( ( QueueHandle_t ) NULL )
|
||||
#define SYS_SEM_NULL ( ( SemaphoreHandle_t ) NULL )
|
||||
#define SYS_DEFAULT_THREAD_STACK_DEPTH configMINIMAL_STACK_SIZE
|
||||
|
||||
typedef SemaphoreHandle_t sys_sem_t;
|
||||
typedef SemaphoreHandle_t sys_mutex_t;
|
||||
typedef QueueHandle_t sys_mbox_t;
|
||||
typedef TaskHandle_t sys_thread_t;
|
||||
|
||||
#define sys_mbox_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE )
|
||||
#define sys_mbox_set_invalid( x ) ( ( *x ) = NULL )
|
||||
#define sys_sem_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE )
|
||||
#define sys_sem_set_invalid( x ) ( ( *x ) = NULL )
|
||||
|
||||
#define sys_jiffies() xTaskGetTickCount()
|
||||
|
||||
void sys_arch_msleep(uint32_t ms);
|
||||
#define sys_msleep(ms) sys_arch_msleep(ms)
|
||||
|
||||
#endif /* __ARCH_SYS_ARCH_H__ */
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,9 @@
|
|||
* UNLOCK_TCPIP_CORE().
|
||||
* Your system should provide mutexes supporting priority inversion to use this.
|
||||
*/
|
||||
#ifndef LWIP_TCPIP_CORE_LOCKING
|
||||
#define LWIP_TCPIP_CORE_LOCKING 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LWIP_TCPIP_CORE_LOCKING_INPUT: when LWIP_TCPIP_CORE_LOCKING is enabled,
|
||||
|
|
@ -95,6 +97,48 @@
|
|||
#define LWIP_TCPIP_CORE_LOCKING_INPUT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Macro/function to check whether lwIP's threading/locking
|
||||
* requirements are satisfied during current function call.
|
||||
* This macro usually calls a function that is implemented in the OS-dependent
|
||||
* sys layer and performs the following checks:
|
||||
* - Not in ISR
|
||||
* - If @ref LWIP_TCPIP_CORE_LOCKING = 1: TCPIP core lock is held
|
||||
* - If @ref LWIP_TCPIP_CORE_LOCKING = 0: function is called from TCPIP thread
|
||||
* @see @ref multithreading
|
||||
*/
|
||||
#ifndef LWIP_ASSERT_CORE_LOCKED
|
||||
void sys_check_core_locking(void);
|
||||
#define LWIP_ASSERT_CORE_LOCKED() sys_check_core_locking()
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Called as first thing in the lwIP TCPIP thread. Can be used in conjunction
|
||||
* with @ref LWIP_ASSERT_CORE_LOCKED to check core locking.
|
||||
* @see @ref multithreading
|
||||
*/
|
||||
#ifndef LWIP_MARK_TCPIP_THREAD
|
||||
void sys_mark_tcpip_thread(void);
|
||||
#define LWIP_MARK_TCPIP_THREAD() sys_mark_tcpip_thread()
|
||||
#endif
|
||||
|
||||
#if LWIP_TCPIP_CORE_LOCKING
|
||||
|
||||
#ifndef LOCK_TCPIP_CORE
|
||||
void sys_lock_tcpip_core(void);
|
||||
#define LOCK_TCPIP_CORE() sys_lock_tcpip_core()
|
||||
#endif
|
||||
|
||||
#ifndef UNLOCK_TCPIP_CORE
|
||||
void sys_unlock_tcpip_core(void);
|
||||
#define UNLOCK_TCPIP_CORE() sys_unlock_tcpip_core()
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define LOCK_TCPIP_CORE()
|
||||
#define UNLOCK_TCPIP_CORE()
|
||||
#endif /* LWIP_TCPIP_CORE_LOCKING */
|
||||
|
||||
/*
|
||||
------------------------------------
|
||||
---------- Memory options ----------
|
||||
|
|
@ -483,6 +527,21 @@
|
|||
#define LWIP_NETIF_HOSTNAME 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LWIP_NETIF_API==1: Support netif api (in netifapi.c)
|
||||
*/
|
||||
#ifndef LWIP_NETIF_API
|
||||
#define LWIP_NETIF_API 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LWIP_NETIF_STATUS_CALLBACK==1: Support a callback function whenever an interface
|
||||
* changes its up/down status (i.e., due to DHCP IP acquisition)
|
||||
*/
|
||||
#ifndef LWIP_NETIF_STATUS_CALLBACK
|
||||
#define LWIP_NETIF_STATUS_CALLBACK 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LWIP_NETIF_TX_SINGLE_PBUF: if this is set to 1, lwIP *tries* to put all data
|
||||
* to be sent into one single pbuf. This is for compatibility with DMA-enabled
|
||||
|
|
@ -515,7 +574,7 @@
|
|||
* sys_thread_new() when the thread is created.
|
||||
*/
|
||||
#ifndef TCPIP_THREAD_STACKSIZE
|
||||
#define TCPIP_THREAD_STACKSIZE 768
|
||||
#define TCPIP_THREAD_STACKSIZE 480
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
@ -672,6 +731,20 @@
|
|||
---------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
---------------------------------------
|
||||
---------- mDNS options ---------------
|
||||
---------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* LWIP_MDNS_RESPONDER_QUEUE_ANNOUNCEMENTS==1: Unsolicited announcements are
|
||||
* queued and run from a timer callback.
|
||||
*/
|
||||
#ifndef LWIP_MDNS_RESPONDER_QUEUE_ANNOUNCEMENTS
|
||||
#define LWIP_MDNS_RESPONDER_QUEUE_ANNOUNCEMENTS 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
---------------------------------------
|
||||
---------- Debugging options ----------
|
||||
|
|
@ -855,6 +928,11 @@
|
|||
*/
|
||||
#define IP6_DEBUG LWIP_DBG_OFF
|
||||
|
||||
/**
|
||||
* MDNS_DEBUG: Enable debugging for multicast DNS.
|
||||
*/
|
||||
#define MDNS_DEBUG LWIP_DBG_OFF
|
||||
|
||||
/*
|
||||
--------------------------------------------------
|
||||
---------- Performance tracking options ----------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue