Blame src/vma/lwip/opt.h

Packit Service aa3af4
/**
Packit Service aa3af4
 * @file
Packit Service aa3af4
 *
Packit Service aa3af4
 * lwIP Options Configuration
Packit Service aa3af4
 */
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
Packit Service aa3af4
 * All rights reserved. 
Packit Service aa3af4
 * 
Packit Service aa3af4
 * Redistribution and use in source and binary forms, with or without modification, 
Packit Service aa3af4
 * are permitted provided that the following conditions are met:
Packit Service aa3af4
 *
Packit Service aa3af4
 * 1. Redistributions of source code must retain the above copyright notice,
Packit Service aa3af4
 *    this list of conditions and the following disclaimer.
Packit Service aa3af4
 * 2. Redistributions in binary form must reproduce the above copyright notice,
Packit Service aa3af4
 *    this list of conditions and the following disclaimer in the documentation
Packit Service aa3af4
 *    and/or other materials provided with the distribution.
Packit Service aa3af4
 * 3. The name of the author may not be used to endorse or promote products
Packit Service aa3af4
 *    derived from this software without specific prior written permission. 
Packit Service aa3af4
 *
Packit Service aa3af4
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
Packit Service aa3af4
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
Packit Service aa3af4
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
Packit Service aa3af4
 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
Packit Service aa3af4
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
Packit Service aa3af4
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
Packit Service aa3af4
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
Packit Service aa3af4
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
Packit Service aa3af4
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
Packit Service aa3af4
 * OF SUCH DAMAGE.
Packit Service aa3af4
 *
Packit Service aa3af4
 * This file is part of the lwIP TCP/IP stack.
Packit Service aa3af4
 * 
Packit Service aa3af4
 * Author: Adam Dunkels <adam@sics.se>
Packit Service aa3af4
 *
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef __LWIP_OPT_H__
Packit Service aa3af4
#define __LWIP_OPT_H__
Packit Service aa3af4
Packit Service aa3af4
#ifdef HAVE_CONFIG_H
Packit Service aa3af4
#include "config.h"
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
   ------------------------------------
Packit Service aa3af4
   ---------- Memory options ----------
Packit Service aa3af4
   ------------------------------------
Packit Service aa3af4
*/
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEM_ALIGNMENT: should be set to the alignment of the CPU
Packit Service aa3af4
 *    4 byte alignment -> #define MEM_ALIGNMENT 4
Packit Service aa3af4
 *    2 byte alignment -> #define MEM_ALIGNMENT 2
Packit Service aa3af4
 */
Packit Service aa3af4
#define MEM_ALIGNMENT                   4
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEM_SIZE: the size of the heap memory. If the application will send
Packit Service aa3af4
 * a lot of data that needs to be copied, this should be set high.
Packit Service aa3af4
 */
Packit Service aa3af4
//16000
Packit Service aa3af4
#ifdef _LWIP_MIN_MEM_MODE
Packit Service aa3af4
#define MEM_SIZE                       	16000 //128000
Packit Service aa3af4
#else
Packit Service aa3af4
#define MEM_SIZE                       	512000 //128000
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEM_USE_POOLS==1: Use an alternative to malloc() by allocating from a set
Packit Service aa3af4
 * of memory pools of various sizes. When mem_malloc is called, an element of
Packit Service aa3af4
 * the smallest pool that can provide the length needed is returned.
Packit Service aa3af4
 * To use this, MEMP_USE_CUSTOM_POOLS also has to be enabled.
Packit Service aa3af4
 */
Packit Service aa3af4
#define MEM_USE_POOLS                   1
Packit Service aa3af4
#define MEMP_USE_CUSTOM_POOLS		1
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
   ------------------------------------------------
Packit Service aa3af4
   ---------- Internal Memory Pool Sizes ----------
Packit Service aa3af4
   ------------------------------------------------
Packit Service aa3af4
*/
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF).
Packit Service aa3af4
 * If the application sends a lot of data out of ROM (or other static memory),
Packit Service aa3af4
 * this should be set high.
Packit Service aa3af4
 */
Packit Service aa3af4
//30
Packit Service aa3af4
#ifdef _LWIP_MIN_MEM_MODE
Packit Service aa3af4
#define MEMP_NUM_PBUF                   30
Packit Service aa3af4
#else
Packit Service aa3af4
#define MEMP_NUM_PBUF                   0 //1024
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections.
Packit Service aa3af4
 * (requires the LWIP_TCP option)
Packit Service aa3af4
 */
Packit Service aa3af4
#define MEMP_NUM_TCP_PCB               	1 //32768
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
Packit Service aa3af4
 * (requires the LWIP_TCP option)
Packit Service aa3af4
 */
Packit Service aa3af4
#define MEMP_NUM_TCP_PCB_LISTEN         1 //1024
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
Packit Service aa3af4
 * (requires the LWIP_TCP option)
Packit Service aa3af4
 */
Packit Service aa3af4
//64
Packit Service aa3af4
#ifdef _LWIP_MIN_MEM_MODE
Packit Service aa3af4
#define MEMP_NUM_TCP_SEG                64
Packit Service aa3af4
#else
Packit Service aa3af4
#define MEMP_NUM_TCP_SEG                0 //16384
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
Packit Service aa3af4
 */
Packit Service aa3af4
//32
Packit Service aa3af4
#ifdef _LWIP_MIN_MEM_MODE
Packit Service aa3af4
#define PBUF_POOL_SIZE                  32
Packit Service aa3af4
#else
Packit Service aa3af4
#define PBUF_POOL_SIZE                 	0 //256000
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
Packit Service aa3af4
/** ETH_PAD_SIZE: number of bytes added before the ethernet header to ensure
Packit Service aa3af4
 * alignment of payload after that header. Since the header is 14 bytes long,
Packit Service aa3af4
 * without this padding e.g. addresses in the IP header will not be aligned
Packit Service aa3af4
 * on a 32-bit boundary, so setting this to 2 can speed up 32-bit-platforms.
Packit Service aa3af4
 */
Packit Service aa3af4
#define ETH_PAD_SIZE                    0
Packit Service aa3af4
Packit Service aa3af4
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
   --------------------------------
Packit Service aa3af4
   ---------- IP options ----------
Packit Service aa3af4
   --------------------------------
Packit Service aa3af4
*/
Packit Service aa3af4
/**
Packit Service aa3af4
 * IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers.
Packit Service aa3af4
 */
Packit Service aa3af4
#define IP_DEFAULT_TTL                  255
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
   ---------------------------------
Packit Service aa3af4
   ---------- TCP options ----------
Packit Service aa3af4
   ---------------------------------
Packit Service aa3af4
*/
Packit Service aa3af4
/**
Packit Service aa3af4
 * LWIP_TCP==1: Turn on TCP.
Packit Service aa3af4
 */
Packit Service aa3af4
#define LWIP_TCP                        1
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_QUICKACK_THRESHOLD: TCP quickack threshold (bytes)
Packit Service aa3af4
 * Quickack will be sent for payload <= TCP_QUICKACK_THRESHOLD.
Packit Service aa3af4
 * if TCP_QUICKACK_THRESHOLD = 0, quickack threshold is disabled.
Packit Service aa3af4
 * The threshold is effective only when TCP_QUICKACK is enabled.
Packit Service aa3af4
 */
Packit Service aa3af4
#define TCP_QUICKACK_THRESHOLD          0
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_WND: The size of a TCP window.  This must be at least
Packit Service aa3af4
 * (2 * TCP_MSS) for things to work well
Packit Service aa3af4
 */
Packit Service aa3af4
#define TCP_WND                         0xFFFF
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_MSS: TCP Maximum segment size. (default is 536, a conservative default,
Packit Service aa3af4
 * you might want to increase this.)
Packit Service aa3af4
 * For the receive side, this MSS is advertised to the remote side
Packit Service aa3af4
 * when opening a connection. For the transmit size, this MSS sets
Packit Service aa3af4
 * an upper limit on the MSS advertised by the remote host.
Packit Service aa3af4
 */
Packit Service aa3af4
/*
Packit Service aa3af4
 * If you don't want to use lwip_tcp_mss for setting the mss during runtime, define TCP_MSS to the DEFAULT_TCP_MSS
Packit Service aa3af4
 */
Packit Service aa3af4
#define CONST_TCP_MSS 		1460
Packit Service aa3af4
#define LWIP_TCP_MSS                         (lwip_tcp_mss)
Packit Service aa3af4
//#define TCP_MSS 			CONST_TCP_MSS
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_SND_BUF: TCP sender buffer space (bytes).
Packit Service aa3af4
 */
Packit Service aa3af4
//4096
Packit Service aa3af4
#ifdef _LWIP_MIN_MEM_MODE
Packit Service aa3af4
#define TCP_SND_BUF                     4096 //256*1024
Packit Service aa3af4
#else
Packit Service aa3af4
#define TCP_SND_BUF                     1000000 //100000 //256000
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
#define TCP_SND_BUF_NO_NAGLE 256000
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
   ----------------------------------
Packit Service aa3af4
   ---------- Pbuf options ----------
Packit Service aa3af4
   ----------------------------------
Packit Service aa3af4
*/
Packit Service aa3af4
/**
Packit Service aa3af4
 * PBUF_LINK_HLEN: the number of bytes that should be allocated for a
Packit Service aa3af4
 * link level header. The default is 14, the standard value for
Packit Service aa3af4
 * Ethernet.
Packit Service aa3af4
 */
Packit Service aa3af4
#define PBUF_LINK_HLEN                  20
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
   ----------------------------------------
Packit Service aa3af4
   ---------- Statistics options ----------
Packit Service aa3af4
   ----------------------------------------
Packit Service aa3af4
*/
Packit Service aa3af4
/**
Packit Service aa3af4
 * LWIP_STATS==1: Enable statistics collection in lwip_stats.
Packit Service aa3af4
 * NOTE: enabling stats adds about 300-400ns to latency
Packit Service aa3af4
 */
Packit Service aa3af4
#define LWIP_STATS                      0
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * LWIP_STATS_DISPLAY==1: Compile in the statistics output functions.
Packit Service aa3af4
 */
Packit Service aa3af4
#define LWIP_STATS_DISPLAY              0
Packit Service aa3af4
// use 32 bit counters in stats
Packit Service aa3af4
#define LWIP_STATS_LARGE		0
Packit Service aa3af4
Packit Service aa3af4
Packit Service aa3af4
/* Misc */
Packit Service aa3af4
Packit Service aa3af4
#define LWIP_TIMEVAL_PRIVATE 0
Packit Service aa3af4
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
   --------------------------------------
Packit Service aa3af4
   ---------- Checksum options ----------
Packit Service aa3af4
   --------------------------------------
Packit Service aa3af4
*/
Packit Service aa3af4
// Sasha: disable software tx checksums. Use hca hw csum offload instead
Packit Service aa3af4
/**
Packit Service aa3af4
 * CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.
Packit Service aa3af4
 */
Packit Service aa3af4
#define CHECKSUM_GEN_IP                 0
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.
Packit Service aa3af4
 */
Packit Service aa3af4
#define CHECKSUM_GEN_UDP                0
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.
Packit Service aa3af4
 */
Packit Service aa3af4
#define CHECKSUM_GEN_TCP                0
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.
Packit Service aa3af4
 */
Packit Service aa3af4
#define CHECKSUM_CHECK_IP               0
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.
Packit Service aa3af4
 */
Packit Service aa3af4
#define CHECKSUM_CHECK_UDP              0
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.
Packit Service aa3af4
 */
Packit Service aa3af4
#define CHECKSUM_CHECK_TCP              0
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * LWIP_CHECKSUM_ON_COPY==1: Calculate checksum when copying data from
Packit Service aa3af4
 * application buffers to pbufs.
Packit Service aa3af4
 */
Packit Service aa3af4
#define LWIP_CHECKSUM_ON_COPY           1
Packit Service aa3af4
Packit Service aa3af4
Packit Service aa3af4
// replace lwip byte swapping to optimized one
Packit Service aa3af4
#include <byteswap.h>
Packit Service aa3af4
Packit Service aa3af4
#define LWIP_PLATFORM_BYTESWAP         1
Packit Service aa3af4
#define LWIP_PLATFORM_HTONS(x) bswap_16(x)
Packit Service aa3af4
#define LWIP_PLATFORM_HTONL(x) bswap_32(x)
Packit Service aa3af4
Packit Service aa3af4
#define LWIP_3RD_PARTY_L3 1
Packit Service aa3af4
#define LWIP_3RD_PARTY_BUFS 1
Packit Service aa3af4
Packit Service aa3af4
//enable LWIP DEBUG here
Packit Service aa3af4
#if 1
Packit Service aa3af4
//#define PBUF_DEBUG				LWIP_DBG_ON
Packit Service aa3af4
//#define TCP_DEBUG 				LWIP_DBG_ON
Packit Service aa3af4
//#define TCP_INPUT_DEBUG			LWIP_DBG_ON
Packit Service aa3af4
//#define TCP_FR_DEBUG				LWIP_DBG_ON
Packit Service aa3af4
//#define TCP_RTO_DEBUG 			LWIP_DBG_ON
Packit Service aa3af4
//#define TCP_CWND_DEBUG			LWIP_DBG_ON
Packit Service aa3af4
//#define TCP_WND_DEBUG 			LWIP_DBG_ON
Packit Service aa3af4
//#define TCP_OUTPUT_DEBUG			LWIP_DBG_ON
Packit Service aa3af4
//#define TCP_RST_DEBUG 			LWIP_DBG_ON
Packit Service aa3af4
//#define TCP_QLEN_DEBUG			LWIP_DBG_ON
Packit Service aa3af4
//#define TCP_TSO_DEBUG				LWIP_DBG_ON
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
   -----------------------------------------------
Packit Service aa3af4
   ---------- Platform specific locking ----------
Packit Service aa3af4
   -----------------------------------------------
Packit Service aa3af4
*/
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
Packit Service aa3af4
 * critical regions during buffer allocation, deallocation and memory
Packit Service aa3af4
 * allocation and deallocation.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef SYS_LIGHTWEIGHT_PROT
Packit Service aa3af4
#define SYS_LIGHTWEIGHT_PROT            0
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/** 
Packit Service aa3af4
 * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
Packit Service aa3af4
 * use lwIP facilities.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef NO_SYS
Packit Service aa3af4
#define NO_SYS                          0
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * NO_SYS_NO_TIMERS==1: Drop support for sys_timeout when NO_SYS==1
Packit Service aa3af4
 * Mainly for compatibility to old versions.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef NO_SYS_NO_TIMERS
Packit Service aa3af4
#define NO_SYS_NO_TIMERS                0
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEMCPY: override this if you have a faster implementation at hand than the
Packit Service aa3af4
 * one included in your C library
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef MEMCPY
Packit Service aa3af4
#define MEMCPY(dst,src,len)             memcpy(dst,src,len)
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * SMEMCPY: override this with care! Some compilers (e.g. gcc) can inline a
Packit Service aa3af4
 * call to memcpy() if the length is known at compile time and is small.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef SMEMCPY
Packit Service aa3af4
#define SMEMCPY(dst,src,len)            memcpy(dst,src,len)
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
   ------------------------------------
Packit Service aa3af4
   ---------- Memory options ----------
Packit Service aa3af4
   ------------------------------------
Packit Service aa3af4
*/
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEM_LIBC_MALLOC==1: Use malloc/free/realloc provided by your C-library
Packit Service aa3af4
 * instead of the lwip internal allocator. Can save code size if you
Packit Service aa3af4
 * already use it.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef MEM_LIBC_MALLOC
Packit Service aa3af4
#define MEM_LIBC_MALLOC                 0
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
* MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator.
Packit Service aa3af4
* Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution
Packit Service aa3af4
* speed and usage from interrupts!
Packit Service aa3af4
*/
Packit Service aa3af4
#ifndef MEMP_MEM_MALLOC
Packit Service aa3af4
#define MEMP_MEM_MALLOC                 0
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEM_ALIGNMENT: should be set to the alignment of the CPU
Packit Service aa3af4
 *    4 byte alignment -> #define MEM_ALIGNMENT 4
Packit Service aa3af4
 *    2 byte alignment -> #define MEM_ALIGNMENT 2
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef MEM_ALIGNMENT
Packit Service aa3af4
#define MEM_ALIGNMENT                   1
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEM_SIZE: the size of the heap memory. If the application will send
Packit Service aa3af4
 * a lot of data that needs to be copied, this should be set high.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef MEM_SIZE
Packit Service aa3af4
#define MEM_SIZE                        1600
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEMP_SEPARATE_POOLS: if defined to 1, each pool is placed in its own array.
Packit Service aa3af4
 * This can be used to individually change the location of each pool.
Packit Service aa3af4
 * Default is one big array for all pools
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef MEMP_SEPARATE_POOLS
Packit Service aa3af4
#define MEMP_SEPARATE_POOLS             0
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEMP_OVERFLOW_CHECK: memp overflow protection reserves a configurable
Packit Service aa3af4
 * amount of bytes before and after each memp element in every pool and fills
Packit Service aa3af4
 * it with a prominent default value.
Packit Service aa3af4
 *    MEMP_OVERFLOW_CHECK == 0 no checking
Packit Service aa3af4
 *    MEMP_OVERFLOW_CHECK == 1 checks each element when it is freed
Packit Service aa3af4
 *    MEMP_OVERFLOW_CHECK >= 2 checks each element in every pool every time
Packit Service aa3af4
 *      memp_malloc() or memp_free() is called (useful but slow!)
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef MEMP_OVERFLOW_CHECK
Packit Service aa3af4
#define MEMP_OVERFLOW_CHECK             0
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEMP_SANITY_CHECK==1: run a sanity check after each memp_free() to make
Packit Service aa3af4
 * sure that there are no cycles in the linked lists.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef MEMP_SANITY_CHECK
Packit Service aa3af4
#define MEMP_SANITY_CHECK               0
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEM_USE_POOLS==1: Use an alternative to malloc() by allocating from a set
Packit Service aa3af4
 * of memory pools of various sizes. When mem_malloc is called, an element of
Packit Service aa3af4
 * the smallest pool that can provide the length needed is returned.
Packit Service aa3af4
 * To use this, MEMP_USE_CUSTOM_POOLS also has to be enabled.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef MEM_USE_POOLS
Packit Service aa3af4
#define MEM_USE_POOLS                   0
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEM_USE_POOLS_TRY_BIGGER_POOL==1: if one malloc-pool is empty, try the next
Packit Service aa3af4
 * bigger pool - WARNING: THIS MIGHT WASTE MEMORY but it can make a system more
Packit Service aa3af4
 * reliable. */
Packit Service aa3af4
#ifndef MEM_USE_POOLS_TRY_BIGGER_POOL
Packit Service aa3af4
#define MEM_USE_POOLS_TRY_BIGGER_POOL   1
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEMP_USE_CUSTOM_POOLS==1: whether to include a user file lwippools.h
Packit Service aa3af4
 * that defines additional pools beyond the "standard" ones required
Packit Service aa3af4
 * by lwIP. If you set this to 1, you must have lwippools.h in your 
Packit Service aa3af4
 * inlude path somewhere. 
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef MEMP_USE_CUSTOM_POOLS
Packit Service aa3af4
#define MEMP_USE_CUSTOM_POOLS           0
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * Set this to 1 if you want to free PBUF_RAM pbufs (or call mem_free()) from
Packit Service aa3af4
 * interrupt context (or another context that doesn't allow waiting for a
Packit Service aa3af4
 * semaphore).
Packit Service aa3af4
 * If set to 1, mem_malloc will be protected by a semaphore and SYS_ARCH_PROTECT,
Packit Service aa3af4
 * while mem_free will only use SYS_ARCH_PROTECT. mem_malloc SYS_ARCH_UNPROTECTs
Packit Service aa3af4
 * with each loop so that mem_free can run.
Packit Service aa3af4
 *
Packit Service aa3af4
 * ATTENTION: As you can see from the above description, this leads to dis-/
Packit Service aa3af4
 * enabling interrupts often, which can be slow! Also, on low memory, mem_malloc
Packit Service aa3af4
 * can need longer.
Packit Service aa3af4
 *
Packit Service aa3af4
 * If you don't want that, at least for NO_SYS=0, you can still use the following
Packit Service aa3af4
 * functions to enqueue a deallocation call which then runs in the tcpip_thread
Packit Service aa3af4
 * context:
Packit Service aa3af4
 * - pbuf_free_callback(p);
Packit Service aa3af4
 * - mem_free_callback(m);
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT
Packit Service aa3af4
#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 0
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
   ------------------------------------------------
Packit Service aa3af4
   ---------- Internal Memory Pool Sizes ----------
Packit Service aa3af4
   ------------------------------------------------
Packit Service aa3af4
*/
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF).
Packit Service aa3af4
 * If the application sends a lot of data out of ROM (or other static memory),
Packit Service aa3af4
 * this should be set high.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef MEMP_NUM_PBUF
Packit Service aa3af4
#define MEMP_NUM_PBUF                   16
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections.
Packit Service aa3af4
 * (requires the LWIP_TCP option)
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef MEMP_NUM_TCP_PCB
Packit Service aa3af4
#define MEMP_NUM_TCP_PCB                5
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
Packit Service aa3af4
 * (requires the LWIP_TCP option)
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef MEMP_NUM_TCP_PCB_LISTEN
Packit Service aa3af4
#define MEMP_NUM_TCP_PCB_LISTEN         8
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
Packit Service aa3af4
 * (requires the LWIP_TCP option)
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef MEMP_NUM_TCP_SEG
Packit Service aa3af4
#define MEMP_NUM_TCP_SEG                16
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * PBUF_POOL_SIZE: the number of buffers in the pbuf pool. 
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef PBUF_POOL_SIZE
Packit Service aa3af4
#define PBUF_POOL_SIZE                  16
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/** ETH_PAD_SIZE: number of bytes added before the ethernet header to ensure
Packit Service aa3af4
 * alignment of payload after that header. Since the header is 14 bytes long,
Packit Service aa3af4
 * without this padding e.g. addresses in the IP header will not be aligned
Packit Service aa3af4
 * on a 32-bit boundary, so setting this to 2 can speed up 32-bit-platforms.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef ETH_PAD_SIZE
Packit Service aa3af4
#define ETH_PAD_SIZE                    0
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef IP_DEFAULT_TTL
Packit Service aa3af4
#define IP_DEFAULT_TTL                  255
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
   ---------------------------------
Packit Service aa3af4
   ---------- TCP options ----------
Packit Service aa3af4
   ---------------------------------
Packit Service aa3af4
*/
Packit Service aa3af4
/**
Packit Service aa3af4
 * LWIP_TCP==1: Turn on TCP.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef LWIP_TCP
Packit Service aa3af4
#define LWIP_TCP                        1
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_TTL: Default Time-To-Live value.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_TTL
Packit Service aa3af4
#define TCP_TTL                         (IP_DEFAULT_TTL)
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_WND: The size of a TCP window.  This must be at least 
Packit Service aa3af4
 * (2 * TCP_MSS) for things to work well
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_WND
Packit Service aa3af4
#error make sure TCP_WND is not defined here
Packit Service aa3af4
/* If ever this definition is effective - please note that LWIP_TCP_MSS may be 0 */
Packit Service aa3af4
#define TCP_WND                         (4 * LWIP_TCP_MSS)
Packit Service aa3af4
#endif 
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
 * use custom congestion control algorithms
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_CC_ALGO_MOD
Packit Service aa3af4
#define TCP_CC_ALGO_MOD 1
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
 /**
Packit Service aa3af4
 * window scaling parameter
Packit Service aa3af4
 */
Packit Service aa3af4
#define TCP_WND_SCALED(pcb) 		(TCP_WND << (pcb)->rcv_scale)
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_MAXRTX: Maximum number of retransmissions of data segments.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_MAXRTX
Packit Service aa3af4
#define TCP_MAXRTX                      12
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_SYNMAXRTX: Maximum number of retransmissions of SYN segments.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_SYNMAXRTX
Packit Service aa3af4
#define TCP_SYNMAXRTX                   6
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_QUEUE_OOSEQ==1: TCP will queue segments that arrive out of order.
Packit Service aa3af4
 * Define to 0 if your device is low on memory.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_QUEUE_OOSEQ
Packit Service aa3af4
#define TCP_QUEUE_OOSEQ                 (LWIP_TCP)
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_CALCULATE_EFF_SEND_MSS: "The maximum size of a segment that TCP really
Packit Service aa3af4
 * sends, the 'effective send MSS,' MUST be the smaller of the send MSS (which
Packit Service aa3af4
 * reflects the available reassembly buffer size at the remote host) and the
Packit Service aa3af4
 * largest size permitted by the IP layer" (RFC 1122)
Packit Service aa3af4
 * Setting this to 1 enables code that checks TCP_MSS against the MTU of the
Packit Service aa3af4
 * netif used for a connection and limits the MSS if it would be too big otherwise.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_CALCULATE_EFF_SEND_MSS
Packit Service aa3af4
#define TCP_CALCULATE_EFF_SEND_MSS      1
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_SND_BUF: TCP sender buffer space (bytes). 
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_SND_BUF
Packit Service aa3af4
#define TCP_SND_BUF                     256
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
Packit Service aa3af4
 * as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_SND_QUEUELEN
Packit Service aa3af4
#define CONST_TCP_SND_QUEUELEN                (4 * (TCP_SND_BUF)/(CONST_TCP_MSS))
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_SNDLOWAT: TCP writable space (bytes). This must be less than
Packit Service aa3af4
 * TCP_SND_BUF. It is the amount of space which must be available in the
Packit Service aa3af4
 * TCP snd_buf for select to return writable (combined with TCP_SNDQUEUELOWAT).
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_SNDLOWAT
Packit Service aa3af4
#define TCP_SNDLOWAT                    ((TCP_SND_BUF)/2)
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_SNDQUEUELOWAT: TCP writable bufs (pbuf count). This must be grater
Packit Service aa3af4
 * than TCP_SND_QUEUELEN. If the number of pbufs queued on a pcb drops below
Packit Service aa3af4
 * this number, select returns writable (combined with TCP_SNDLOWAT).
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_SNDQUEUELOWAT
Packit Service aa3af4
#define TCP_SNDQUEUELOWAT               ((TCP_SND_QUEUELEN)/2)
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_OVERSIZE: The maximum number of bytes that tcp_write may
Packit Service aa3af4
 * allocate ahead of time in an attempt to create shorter pbuf chains
Packit Service aa3af4
 * for transmission. The meaningful range is 0 to TCP_MSS. Some
Packit Service aa3af4
 * suggested values are:
Packit Service aa3af4
 *
Packit Service aa3af4
 * 0:         Disable oversized allocation. Each tcp_write() allocates a new
Packit Service aa3af4
              pbuf (old behaviour).
Packit Service aa3af4
 * 1:         Allocate size-aligned pbufs with minimal excess. Use this if your
Packit Service aa3af4
 *            scatter-gather DMA requires aligned fragments.
Packit Service aa3af4
 * 128:       Limit the pbuf/memory overhead to 20%.
Packit Service aa3af4
 * TCP_MSS:   Try to create unfragmented TCP packets.
Packit Service aa3af4
 * TCP_MSS/4: Try to create 4 fragments or less per TCP packet.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_OVERSIZE
Packit Service aa3af4
#define TCP_OVERSIZE                    CONST_TCP_MSS
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * LWIP_TCP_TIMESTAMPS==1: support the TCP timestamp option.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef LWIP_TCP_TIMESTAMPS
Packit Service aa3af4
#define LWIP_TCP_TIMESTAMPS             1
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_WND_UPDATE_THRESHOLD: difference in window to trigger an
Packit Service aa3af4
 * explicit window update
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_WND_UPDATE_THRESHOLD
Packit Service aa3af4
#define TCP_WND_UPDATE_THRESHOLD   (pcb->rcv_wnd_max / 4)
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * LWIP_EVENT_API and LWIP_CALLBACK_API: Only one of these should be set to 1.
Packit Service aa3af4
 *     LWIP_EVENT_API==1: The user defines lwip_tcp_event() to receive all
Packit Service aa3af4
 *         events (accept, sent, etc) that happen in the system.
Packit Service aa3af4
 *     LWIP_CALLBACK_API==1: The PCB callback function is called directly
Packit Service aa3af4
 *         for the event.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef LWIP_EVENT_API
Packit Service aa3af4
#define LWIP_EVENT_API                  0
Packit Service aa3af4
#define LWIP_CALLBACK_API               1
Packit Service aa3af4
#else 
Packit Service aa3af4
#define LWIP_EVENT_API                  1
Packit Service aa3af4
#define LWIP_CALLBACK_API               0
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
   ----------------------------------
Packit Service aa3af4
   ---------- Pbuf options ----------
Packit Service aa3af4
   ----------------------------------
Packit Service aa3af4
*/
Packit Service aa3af4
/**
Packit Service aa3af4
 * PBUF_LINK_HLEN: the number of bytes that should be allocated for a
Packit Service aa3af4
 * link level header. The default is 14, the standard value for
Packit Service aa3af4
 * Ethernet.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef PBUF_LINK_HLEN
Packit Service aa3af4
#define PBUF_LINK_HLEN                  (14 + ETH_PAD_SIZE)
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
   ------------------------------------
Packit Service aa3af4
   ---------- Socket options ----------
Packit Service aa3af4
   ------------------------------------
Packit Service aa3af4
*/
Packit Service aa3af4
/**
Packit Service aa3af4
 * LWIP_TCP_KEEPALIVE==1: Enable TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT
Packit Service aa3af4
 * options processing. Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set
Packit Service aa3af4
 * in seconds. (does not require sockets.c, and will affect tcp.c)
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef LWIP_TCP_KEEPALIVE
Packit Service aa3af4
#define LWIP_TCP_KEEPALIVE              0
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
   ----------------------------------------
Packit Service aa3af4
   ---------- Statistics options ----------
Packit Service aa3af4
   ----------------------------------------
Packit Service aa3af4
*/
Packit Service aa3af4
/**
Packit Service aa3af4
 * LWIP_STATS==1: Enable statistics collection in lwip_stats.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef LWIP_STATS
Packit Service aa3af4
#define LWIP_STATS                      1
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
#if LWIP_STATS
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * LWIP_STATS_DISPLAY==1: Compile in the statistics output functions.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef LWIP_STATS_DISPLAY
Packit Service aa3af4
#define LWIP_STATS_DISPLAY              0
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * LINK_STATS==1: Enable link stats.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef LINK_STATS
Packit Service aa3af4
#define LINK_STATS                      1
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * ETHARP_STATS==1: Enable etharp stats.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef ETHARP_STATS
Packit Service aa3af4
#define ETHARP_STATS                    (LWIP_ARP)
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * IP_STATS==1: Enable IP stats.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef IP_STATS
Packit Service aa3af4
#define IP_STATS                        1
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * IPFRAG_STATS==1: Enable IP fragmentation stats. Default is
Packit Service aa3af4
 * on if using either frag or reass.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef IPFRAG_STATS
Packit Service aa3af4
#define IPFRAG_STATS                    (IP_REASSEMBLY || IP_FRAG)
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_STATS==1: Enable TCP stats. Default is on if TCP
Packit Service aa3af4
 * enabled, otherwise off.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_STATS
Packit Service aa3af4
#define TCP_STATS                       (LWIP_TCP)
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
#else
Packit Service aa3af4
Packit Service aa3af4
#define LINK_STATS                      0
Packit Service aa3af4
#define IP_STATS                        0
Packit Service aa3af4
#define IPFRAG_STATS                    0
Packit Service aa3af4
#define TCP_STATS                       0
Packit Service aa3af4
#define LWIP_STATS_DISPLAY              0
Packit Service aa3af4
Packit Service aa3af4
#endif /* LWIP_STATS */
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
   --------------------------------------
Packit Service aa3af4
   ---------- Checksum options ----------
Packit Service aa3af4
   --------------------------------------
Packit Service aa3af4
*/
Packit Service aa3af4
/**
Packit Service aa3af4
 * CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef CHECKSUM_GEN_IP
Packit Service aa3af4
#define CHECKSUM_GEN_IP                 1
Packit Service aa3af4
#endif
Packit Service aa3af4
 
Packit Service aa3af4
/**
Packit Service aa3af4
 * CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef CHECKSUM_GEN_UDP
Packit Service aa3af4
#define CHECKSUM_GEN_UDP                1
Packit Service aa3af4
#endif
Packit Service aa3af4
 
Packit Service aa3af4
/**
Packit Service aa3af4
 * CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef CHECKSUM_GEN_TCP
Packit Service aa3af4
#define CHECKSUM_GEN_TCP                1
Packit Service aa3af4
#endif
Packit Service aa3af4
 
Packit Service aa3af4
/**
Packit Service aa3af4
 * CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef CHECKSUM_CHECK_IP
Packit Service aa3af4
#define CHECKSUM_CHECK_IP               1
Packit Service aa3af4
#endif
Packit Service aa3af4
 
Packit Service aa3af4
/**
Packit Service aa3af4
 * CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef CHECKSUM_CHECK_UDP
Packit Service aa3af4
#define CHECKSUM_CHECK_UDP              1
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef CHECKSUM_CHECK_TCP
Packit Service aa3af4
#define CHECKSUM_CHECK_TCP              1
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * LWIP_CHECKSUM_ON_COPY==1: Calculate checksum when copying data from
Packit Service aa3af4
 * application buffers to pbufs.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef LWIP_CHECKSUM_ON_COPY
Packit Service aa3af4
#define LWIP_CHECKSUM_ON_COPY           0
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * LWIP_TSO: Enable Large Segment Offload capability.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef LWIP_TSO
Packit Service aa3af4
#ifdef DEFINED_TSO
Packit Service aa3af4
#define LWIP_TSO                        1
Packit Service aa3af4
#else
Packit Service aa3af4
#define LWIP_TSO                        0
Packit Service aa3af4
#endif /* DEFINED_TSO */
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/* Define platform endianness */
Packit Service aa3af4
#ifndef BYTE_ORDER
Packit Service aa3af4
#define BYTE_ORDER LITTLE_ENDIAN
Packit Service aa3af4
#endif /* BYTE_ORDER */
Packit Service aa3af4
Packit Service aa3af4
/* Define generic types used in lwIP */
Packit Service aa3af4
typedef unsigned   char    u8_t;
Packit Service aa3af4
typedef signed     char    s8_t;
Packit Service aa3af4
typedef unsigned   short   u16_t;
Packit Service aa3af4
typedef signed     short   s16_t;
Packit Service aa3af4
typedef unsigned   int     u32_t;
Packit Service aa3af4
typedef signed     int     s32_t;
Packit Service aa3af4
Packit Service aa3af4
typedef unsigned long mem_ptr_t;
Packit Service aa3af4
Packit Service aa3af4
/* Define (sn)printf formatters for these lwIP types */
Packit Service aa3af4
#define X8_F  "02x"
Packit Service aa3af4
#define U16_F "hu"
Packit Service aa3af4
#define S16_F "hd"
Packit Service aa3af4
#define X16_F "hx"
Packit Service aa3af4
#define U32_F "u"
Packit Service aa3af4
#define S32_F "d"
Packit Service aa3af4
#define X32_F "x"
Packit Service aa3af4
Packit Service aa3af4
/* If only we could use C99 and get %zu */
Packit Service aa3af4
#if defined(__x86_64__)
Packit Service aa3af4
#define SZT_F "lu"
Packit Service aa3af4
#else
Packit Service aa3af4
#define SZT_F "u"
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/* Compiler hints for packing structures */
Packit Service aa3af4
#define PACK_STRUCT_FIELD(x) x
Packit Service aa3af4
#define PACK_STRUCT_STRUCT __attribute__((packed))
Packit Service aa3af4
#define PACK_STRUCT_BEGIN
Packit Service aa3af4
#define PACK_STRUCT_END
Packit Service aa3af4
Packit Service aa3af4
/* prototypes for printf() and abort() */
Packit Service aa3af4
#include <stdio.h>
Packit Service aa3af4
#include <stdlib.h>
Packit Service aa3af4
Packit Service aa3af4
#define LWIP_PLATFORM_ASSERT(x) do {printf("Assertion \"%s\" failed at line %d in %s\n", \
Packit Service aa3af4
                                     x, __LINE__, __FILE__); fflush(NULL);} while(0)
Packit Service aa3af4
Packit Service aa3af4
//#define LWIP_PLATFORM_DIAG(x) __log_err x
Packit Service aa3af4
//#define LWIP_PLATFORM_ASSERT(x) __log_panic(x)
Packit Service aa3af4
// disable assertions
Packit Service aa3af4
#define LWIP_NOASSERT
Packit Service aa3af4
Packit Service aa3af4
#define LWIP_RAND() ((u32_t)rand())
Packit Service aa3af4
Packit Service aa3af4
Packit Service aa3af4
#ifndef LWIP_UNUSED_ARG
Packit Service aa3af4
#define LWIP_UNUSED_ARG(x) (void)x
Packit Service aa3af4
#endif /* LWIP_UNUSED_ARG */
Packit Service aa3af4
Packit Service aa3af4
/*
Packit Service aa3af4
   ---------------------------------------
Packit Service aa3af4
   ---------- Debugging options ----------
Packit Service aa3af4
   ---------------------------------------
Packit Service aa3af4
*/
Packit Service aa3af4
Packit Service aa3af4
/** lower two bits indicate debug level
Packit Service aa3af4
 * - 0 all
Packit Service aa3af4
 * - 1 warning
Packit Service aa3af4
 * - 2 serious
Packit Service aa3af4
 * - 3 severe
Packit Service aa3af4
 */
Packit Service aa3af4
#define LWIP_DBG_LEVEL_ALL     0x00
Packit Service aa3af4
#define LWIP_DBG_LEVEL_OFF     LWIP_DBG_LEVEL_ALL /* compatibility define only */
Packit Service aa3af4
#define LWIP_DBG_LEVEL_WARNING 0x01 /* bad checksums, dropped packets, ... */
Packit Service aa3af4
#define LWIP_DBG_LEVEL_SERIOUS 0x02 /* memory allocation failures, ... */
Packit Service aa3af4
#define LWIP_DBG_LEVEL_SEVERE  0x03
Packit Service aa3af4
#define LWIP_DBG_MASK_LEVEL    0x03
Packit Service aa3af4
Packit Service aa3af4
/** flag for LWIP_DEBUGF to enable that debug message */
Packit Service aa3af4
#define LWIP_DBG_ON            0x80U
Packit Service aa3af4
/** flag for LWIP_DEBUGF to disable that debug message */
Packit Service aa3af4
#define LWIP_DBG_OFF           0x00U
Packit Service aa3af4
Packit Service aa3af4
/** flag for LWIP_DEBUGF indicating a tracing message (to follow program flow) */
Packit Service aa3af4
#define LWIP_DBG_TRACE         0x40U
Packit Service aa3af4
/** flag for LWIP_DEBUGF indicating a state debug message (to follow module states) */
Packit Service aa3af4
#define LWIP_DBG_STATE         0x20U
Packit Service aa3af4
/** flag for LWIP_DEBUGF indicating newly added code, not thoroughly tested yet */
Packit Service aa3af4
#define LWIP_DBG_FRESH         0x10U
Packit Service aa3af4
/** flag for LWIP_DEBUGF to halt after printing this debug message */
Packit Service aa3af4
#define LWIP_DBG_HALT          0x08U
Packit Service aa3af4
Packit Service aa3af4
#define LWIP_ASSERT(message, assertion)
Packit Service aa3af4
Packit Service aa3af4
/** if "expression" isn't true, then print "message" and abort process*/
Packit Service aa3af4
#ifndef LWIP_ERROR_ABORT
Packit Service aa3af4
#define LWIP_ERROR_ABORT(message, expression, handler) do { if (!(expression)) { \
Packit Service aa3af4
  LWIP_PLATFORM_ASSERT(message); abort(); handler;}} while(0)
Packit Service aa3af4
#endif /* LWIP_ERROR_ABORT */
Packit Service aa3af4
Packit Service aa3af4
/** if "expression" isn't true, then print "message" and execute "handler" expression */
Packit Service aa3af4
#ifndef LWIP_ERROR
Packit Service aa3af4
#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
Packit Service aa3af4
  LWIP_PLATFORM_ASSERT(message); handler;}} while(0)
Packit Service aa3af4
#endif /* LWIP_ERROR */
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * LWIP_DBG_MIN_LEVEL: After masking, the value of the debug is
Packit Service aa3af4
 * compared against this value. If it is smaller, then debugging
Packit Service aa3af4
 * messages are written.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef LWIP_DBG_MIN_LEVEL
Packit Service aa3af4
#define LWIP_DBG_MIN_LEVEL              LWIP_DBG_LEVEL_ALL
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * LWIP_DBG_TYPES_ON: A mask that can be used to globally enable/disable
Packit Service aa3af4
 * debug messages of certain types.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef LWIP_DBG_TYPES_ON
Packit Service aa3af4
#define LWIP_DBG_TYPES_ON               LWIP_DBG_ON
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * PBUF_DEBUG: Enable debugging in pbuf.c.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef PBUF_DEBUG
Packit Service aa3af4
#define PBUF_DEBUG                      LWIP_DBG_OFF
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_DEBUG: Enable debugging for TCP.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_DEBUG
Packit Service aa3af4
#define TCP_DEBUG                       LWIP_DBG_OFF
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_INPUT_DEBUG: Enable debugging in tcp_in.c for incoming debug.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_INPUT_DEBUG
Packit Service aa3af4
#define TCP_INPUT_DEBUG                 LWIP_DBG_OFF
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_FR_DEBUG: Enable debugging in tcp_in.c for fast retransmit.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_FR_DEBUG
Packit Service aa3af4
#define TCP_FR_DEBUG                    LWIP_DBG_OFF
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_RTO_DEBUG: Enable debugging in TCP for retransmit
Packit Service aa3af4
 * timeout.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_RTO_DEBUG
Packit Service aa3af4
#define TCP_RTO_DEBUG                   LWIP_DBG_OFF
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_CWND_DEBUG: Enable debugging for TCP congestion window.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_CWND_DEBUG
Packit Service aa3af4
#define TCP_CWND_DEBUG                  LWIP_DBG_OFF
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_WND_DEBUG: Enable debugging in tcp_in.c for window updating.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_WND_DEBUG
Packit Service aa3af4
#define TCP_WND_DEBUG                   LWIP_DBG_OFF
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_OUTPUT_DEBUG: Enable debugging in tcp_out.c output functions.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_OUTPUT_DEBUG
Packit Service aa3af4
#define TCP_OUTPUT_DEBUG                LWIP_DBG_OFF
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_RST_DEBUG: Enable debugging for TCP with the RST message.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_RST_DEBUG
Packit Service aa3af4
#define TCP_RST_DEBUG                   LWIP_DBG_OFF
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_QLEN_DEBUG: Enable debugging for TCP queue lengths.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_QLEN_DEBUG
Packit Service aa3af4
#define TCP_QLEN_DEBUG                  LWIP_DBG_OFF
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
/**
Packit Service aa3af4
 * TCP_TSO_DEBUG: Enable debugging for TSO.
Packit Service aa3af4
 */
Packit Service aa3af4
#ifndef TCP_TSO_DEBUG
Packit Service aa3af4
#define TCP_TSO_DEBUG                  LWIP_DBG_OFF
Packit Service aa3af4
#endif
Packit Service aa3af4
Packit Service aa3af4
#define LWIP_DEBUG_ENABLE PBUF_DEBUG | TCP_DEBUG | TCP_INPUT_DEBUG | TCP_FR_DEBUG | TCP_RTO_DEBUG \
Packit Service aa3af4
	| TCP_CWND_DEBUG | TCP_WND_DEBUG | TCP_OUTPUT_DEBUG | TCP_RST_DEBUG | TCP_QLEN_DEBUG \
Packit Service aa3af4
	| TCP_TSO_DEBUG
Packit Service aa3af4
Packit Service aa3af4
#if LWIP_DEBUG_ENABLE
Packit Service aa3af4
Packit Service aa3af4
/* Plaform specific diagnostic output */
Packit Service aa3af4
#define LWIP_PLATFORM_DIAG(x)	do {printf x; fflush(0);} while(0)
Packit Service aa3af4
Packit Service aa3af4
/** print debug message only if debug message type is enabled...
Packit Service aa3af4
 *  AND is of correct type AND is at least LWIP_DBG_LEVEL
Packit Service aa3af4
 */
Packit Service aa3af4
#define LWIP_DEBUGF(debug, message) do { \
Packit Service aa3af4
                               if ( \
Packit Service aa3af4
                                   ((debug) & LWIP_DBG_ON) && \
Packit Service aa3af4
                                   ((debug) & LWIP_DBG_TYPES_ON) && \
Packit Service aa3af4
                                   ((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL)) { \
Packit Service aa3af4
                                 LWIP_PLATFORM_DIAG(message); \
Packit Service aa3af4
                                 if ((debug) & LWIP_DBG_HALT) { \
Packit Service aa3af4
                                   while(1); \
Packit Service aa3af4
                                 } \
Packit Service aa3af4
                               } \
Packit Service aa3af4
                             } while(0)
Packit Service aa3af4
Packit Service aa3af4
#else  /* LWIP_DEBUG_ENABLE */
Packit Service aa3af4
#define LWIP_PLATFORM_DIAG(x)
Packit Service aa3af4
#define LWIP_DEBUGF(debug, message)
Packit Service aa3af4
#endif /* LWIP_DEBUG_ENABLE */
Packit Service aa3af4
Packit Service aa3af4
#endif /* __LWIP_OPT_H__ */