feat(lwip): update lwip component according to IDF

commit ID: 79a5b0b5
This commit is contained in:
yuanjm
2020-07-16 20:23:43 +08:00
parent da3362ecab
commit ef2c714c06
23 changed files with 613 additions and 435 deletions

View File

@@ -45,6 +45,10 @@
#define BYTE_ORDER LITTLE_ENDIAN
#endif // BYTE_ORDER
#ifndef CONFIG_LWIP_ESP_LWIP_ASSERT
#define LWIP_NOASSERT 1
#endif
typedef uint8_t u8_t;
typedef int8_t s8_t;
typedef uint16_t u16_t;

View File

@@ -29,7 +29,7 @@
* Author: Adam Dunkels <adam@sics.se>
*
*/
#ifndef __SYS_ARCH_H__
#define __SYS_ARCH_H__
@@ -44,15 +44,22 @@ extern "C" {
#endif
typedef xSemaphoreHandle sys_sem_t;
typedef xSemaphoreHandle sys_mutex_t;
typedef xTaskHandle sys_thread_t;
typedef SemaphoreHandle_t sys_sem_t;
typedef SemaphoreHandle_t sys_mutex_t;
typedef TaskHandle_t sys_thread_t;
typedef struct sys_mbox_s {
xQueueHandle os_mbox;
QueueHandle_t os_mbox;
void *owner;
}* sys_mbox_t;
/** This is returned by _fromisr() sys functions to tell the outermost function
* that a higher priority task was woken and the scheduler needs to be invoked.
*/
#define ERR_NEED_SCHED 123
void sys_delay_ms(uint32_t ms);
#define sys_msleep(ms) sys_delay_ms(ms)
#define LWIP_COMPAT_MUTEX 0
@@ -64,7 +71,7 @@ typedef struct sys_mbox_s {
#define sys_mbox_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE )
/* Define the sys_mbox_set_invalid() to empty to support lock-free mbox in ESP LWIP.
*
*
* The basic idea about the lock-free mbox is that the mbox should always be valid unless
* no socket APIs are using the socket and the socket is closed. ESP LWIP achieves this by
* following two changes to official LWIP:
@@ -72,9 +79,9 @@ typedef struct sys_mbox_s {
* no one is using the socket.
* 2. Define the sys_mbox_set_invalid() to empty if the mbox is not actually freed.
* The second change is necessary. Consider a common scenario: the application task calls
* The second change is necessary. Consider a common scenario: the application task calls
* recv() to receive packets from the socket, the sys_mbox_valid() returns true. Because there
* is no lock for the mbox, the LWIP CORE can call sys_mbox_set_invalid() to set the mbox at
* is no lock for the mbox, the LWIP CORE can call sys_mbox_set_invalid() to set the mbox at
* anytime and the thread-safe issue may happen.
*
* However, if the sys_mbox_set_invalid() is not called after sys_mbox_free(), e.g. in netconn_alloc(),

View File

@@ -15,6 +15,6 @@
#ifndef INET_H_
#define INET_H_
#include "../../../lwip/src/include/lwip/inet.h"
#include "lwip/inet.h"
#endif /* INET_H_ */

View File

@@ -169,18 +169,32 @@
--------------------------------
*/
/**
* IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that
* IP_REASSEMBLY==1: Reassemble incoming fragmented IP4 packets. Note that
* this option does not affect outgoing packet sizes, which can be controlled
* via IP_FRAG.
*/
#define IP_REASSEMBLY CONFIG_LWIP_IP_REASSEMBLY
#define IP_REASSEMBLY CONFIG_LWIP_IP4_REASSEMBLY
/**
* IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note
* LWIP_IPV6_REASS==1: reassemble incoming IP6 packets that fragmented. Note that
* this option does not affect outgoing packet sizes, which can be controlled
* via LWIP_IPV6_FRAG.
*/
#define LWIP_IPV6_REASS CONFIG_LWIP_IP6_REASSEMBLY
/**
* IP_FRAG==1: Fragment outgoing IP4 packets if their size exceeds MTU. Note
* that this option does not affect incoming packet sizes, which can be
* controlled via IP_REASSEMBLY.
*/
#define IP_FRAG CONFIG_LWIP_IP_FRAG
#define IP_FRAG CONFIG_LWIP_IP4_FRAG
/**
* LWIP_IPV6_FRAG==1: Fragment outgoing IP6 packets if their size exceeds MTU. Note
* that this option does not affect incoming packet sizes, which can be
* controlled via IP_REASSEMBLY.
*/
#define LWIP_IPV6_FRAG CONFIG_LWIP_IP6_FRAG
/**
* IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally)
@@ -197,6 +211,20 @@
*/
#define IP_REASS_MAX_PBUFS 10
/**
* IP_FORWARD==1: Enables the ability to forward IP packets across network
* interfaces. If you are going to run lwIP on a device with only one network
* interface, define this to 0.
*/
#define IP_FORWARD CONFIG_LWIP_IP_FORWARD
/**
* IP_NAPT==1: Enables IPv4 Network Address and Port Translation.
* Note that both CONFIG_LWIP_IP_FORWARD and CONFIG_LWIP_L2_TO_L3_COPY options
* need to be enabled in system configuration for the NAPT to work on ESP platform
*/
#define IP_NAPT CONFIG_LWIP_IPV4_NAPT
/*
----------------------------------
---------- ICMP options ----------
@@ -323,6 +351,11 @@
*/
#define TCP_QUEUE_OOSEQ CONFIG_LWIP_TCP_QUEUE_OOSEQ
/**
* LWIP_TCP_SACK_OUT==1: TCP will support sending selective acknowledgements (SACKs).
*/
#define LWIP_TCP_SACK_OUT CONFIG_LWIP_TCP_SACK_OUT
/**
* ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES==1: Keep TCP connection when IP changed
* scenario happens: 192.168.0.2 -> 0.0.0.0 -> 192.168.0.2 or 192.168.0.2 -> 0.0.0.0
@@ -393,6 +426,12 @@
#define TCP_RCV_SCALE CONFIG_LWIP_TCP_RCV_SCALE
#endif
/**
* LWIP_TCP_RTO_TIME: TCP rto time.
* Default is 3 second.
*/
#define LWIP_TCP_RTO_TIME CONFIG_LWIP_TCP_RTO_TIME
/*
----------------------------------
---------- Pbuf options ----------
@@ -562,6 +601,11 @@
*/
#define LWIP_TCP_KEEPALIVE 1
/**
* LWIP_SO_LINGER==1: Enable SO_LINGER processing.
*/
#define LWIP_SO_LINGER CONFIG_LWIP_SO_LINGER
/**
* LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
*/
@@ -625,6 +669,14 @@
#if PPP_SUPPORT
/**
* PPP_IPV6_SUPPORT == 1: Enable IPV6 support for local link
* between modem and lwIP stack.
* Some modems do not support IPV6 addressing in local link and
* the only option available is to disable IPV6 address negotiation.
*/
#define PPP_IPV6_SUPPORT CONFIG_LWIP_PPP_ENABLE_IPV6
/**
* PPP_NOTIFY_PHASE==1: Support PPP notify phase.
*/
@@ -667,6 +719,8 @@
#if PPP_DEBUG_ON
#define PPP_DEBUG LWIP_DBG_ON
#define PRINTPKT_SUPPORT 1
#define PPP_PROTOCOLNAME 1
#else
#define PPP_DEBUG LWIP_DBG_OFF
#endif
@@ -793,7 +847,6 @@
#define ESP_THREAD_SAFE_DEBUG LWIP_DBG_OFF
#define ESP_DHCP 1
#define ESP_DNS 1
#define ESP_IPV6_AUTOCONFIG LWIP_IPV6
#define ESP_PERF 0
#define ESP_RANDOM_TCP_PORT 1
#define ESP_IP4_ATON 1
@@ -817,6 +870,10 @@
#define ESP_LWIP_SELECT 1
#define ESP_LWIP_LOCK 1
#ifdef CONFIG_LWIP_IPV6_AUTOCONFIG
#define ESP_IPV6_AUTOCONFIG CONFIG_LWIP_IPV6_AUTOCONFIG
#endif
#ifdef ESP_IRAM_ATTR
#undef ESP_IRAM_ATTR
#endif
@@ -873,7 +930,10 @@ void tcp_print_status(int status, void* p, uint32_t tmp1, uint32_t tmp2, uint32_
*/
#define SNTP_SERVER_DNS 1
#define SNTP_UPDATE_DELAY CONFIG_LWIP_SNTP_UPDATE_DELAY
// It disables a check of SNTP_UPDATE_DELAY it is done in sntp_set_sync_interval
#define SNTP_SUPPRESS_DELAY_CHECK
#define SNTP_UPDATE_DELAY (sntp_get_sync_interval())
#define SNTP_SET_SYSTEM_TIME_US(sec, us) \
do { \

View File

@@ -1,4 +1,5 @@
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
// Copyright 2020 Francesco Giancane <francesco.giancane@accenture.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,22 +13,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _NETINET_TCP_H
#define _NETINET_TCP_H
#ifndef _NETTEST_LWIP_IF_H_
#define _NETTEST_LWIP_IF_H_
#include "lwip/tcp.h"
#include "lwip/err.h"
#ifdef __cplusplus
extern "C" {
#endif
err_t nettestif_init(struct netif *netif);
void nettestif_input(void *buffer, u16_t len);
#ifdef __cplusplus
}
#endif
#endif /* _NETTEST_LWIP_IF_H_ */
#endif /* _NETINET_TCP_H */