blob: 9548bb054260d636e4be35afcb9e3137a484919a [file] [log] [blame]
/*
*
* Copyright (c) 2012-2013 Nest Labs, Inc.
* All rights reserved.
*
* Description:
* This file describes compile-time constants used for
* configuring LwIP.
*
*/
/*
* Copyright 2012, Broadcom Corporation
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
* the contents of this file may not be disclosed to third parties, copied
* or duplicated in any form, in whole or in part, without the prior
* written permission of Broadcom Corporation.
*/
/*
* 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 __T2_LWIPOPTS_H__
#define __T2_LWIPOPTS_H__
#include <stdlib.h>
#include <network/wwd_network_constants.h>
#include "common/lwipopts.h"
#include "nlertaskpriority.h"
#ifdef CUSTOM_LWIPOPTS
#include "custom_lwipopts.h"
#else /* ifdef CUSTOM_LWIPOPTS */
/**
* MEM_ALIGNMENT: should be set to the alignment of the CPU
* 4 byte alignment -> #define MEM_ALIGNMENT 4
* 2 byte alignment -> #define MEM_ALIGNMENT 2
*/
#define MEM_ALIGNMENT (4)
/**
* MEMP_NUM_NETBUF: the number of struct netbufs.
* (only needed if you use the sequential API, like api_lib.c)
*/
#define MEMP_NUM_NETBUF (PBUF_POOL_SIZE)
/**
* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
* (requires the LWIP_TCP option)
*/
#define MEMP_NUM_TCP_SEG (TCP_SND_QUEUELEN+1)
/**
* PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
*
* This is just a default designed to be overriden by the FreeRTOS.mk makefile
* To perform this override, define the makefile variable LWIP_NUM_PACKET_BUFFERS_IN_POOL
*/
#ifndef PBUF_POOL_SIZE
#define PBUF_POOL_SIZE (12)
#endif
/*
* IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.
* Since the received pbufs are enqueued, be sure to configure
* PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive
* packets even if the maximum amount of fragments is enqueued for reassembly!
*
*/
#if PBUF_POOL_SIZE > 2
#ifndef IP_REASS_MAX_PBUFS
#define IP_REASS_MAX_PBUFS (PBUF_POOL_SIZE - 2)
#endif
#else
#define IP_REASS_MAX_PBUFS 0
#define IP_REASSEMBLY 0
#endif
/**
* MEMP_NUM_REASSDATA: the number of IP packets simultaneously queued for
* reassembly (whole packets, not fragments!)
*/
#if IP_REASS_MAX_PBUFS > 1
#ifndef MEMP_NUM_REASSDATA
#define MEMP_NUM_REASSDATA (IP_REASS_MAX_PBUFS - 1)
#endif
#else
#define MEMP_NUM_REASSDATA 0
#endif
/**
* 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.
*/
// Make a bigger pbuf, wifi passthru wants a 0x624
#define PBUF_SIZE 0x640
//#define PBUF_POOL_BUFSIZE (LWIP_MEM_ALIGN_SIZE(WICED_LINK_MTU) + LWIP_MEM_ALIGN_SIZE(sizeof(struct pbuf)) + 1)
#define PBUF_POOL_BUFSIZE (LWIP_MEM_ALIGN_SIZE(PBUF_SIZE) + LWIP_MEM_ALIGN_SIZE(sizeof(struct pbuf)) + 1)
/**
* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
* per active UDP "connection".
* (requires the LWIP_UDP option)
* LWIP_DHCP and LWIP_DNS are used by LWIP, and the 6 are used by UDP endpoints in InetLayer.
*
* See #INET_CONFIG_NUM_UDP_ENDPOINTS for InetLayer configuration.
*/
#ifdef MEMP_NUM_UDP_PCB
#undef MEMP_NUM_UDP_PCB
#define MEMP_NUM_UDP_PCB (6 + (LWIP_DHCP) + (LWIP_DNS))
#endif
/**
* TCP_MSS: TCP Maximum segment size. (default is 536, a conservative default,
* you might want to increase this.)
* For the receive side, this MSS is advertised to the remote side
* when opening a connection. For the transmit size, this MSS sets
* an upper limit on the MSS advertised by the remote host.
*/
/* *** IMPORTANT ***
*
* DO NOT increase this beyond the point at which a TCP segement will fit within a single PBUF, otherwise
* the code in the WICED netif output function (host_hardware_output() in wiced-network.cpp) will fail.
*
* The limit is effectively WICED_LINK_MTU - (WICED_LINK_OVERHEAD_BELOW_ETHERNET_FRAME + WICED_ETHERNET_SIZE + 60)
*/
#define TCP_MSS (1152)
/**
* TCP_SND_BUF: TCP sender buffer space (bytes).
* must be at least as much as (2 * TCP_MSS) for things to work smoothly
*/
#define TCP_SND_BUF (6 * TCP_MSS)
/**
* ETH_PAD_SIZE: the header space required preceeding the 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.
*
* This is zero since the role has been taken over by SUB_ETHERNET_HEADER_SPACE as ETH_PAD_SIZE was not always obeyed
*/
#define ETH_PAD_SIZE (0)
#define SUB_ETHERNET_HEADER_SPACE (WICED_LINK_OVERHEAD_BELOW_ETHERNET_FRAME)
/**
* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
* link level header. The default is 14, the standard value for
* Ethernet.
*/
#define PBUF_LINK_HLEN (WICED_PHYSICAL_HEADER)
/**
* TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread.
* The stack size value itself is platform-dependent, but is passed to
* sys_thread_new() when the thread is created.
*/
#define TCPIP_THREAD_STACKSIZE (1300)
/**
* TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread.
* The priority value itself is platform-dependent, but is passed to
* sys_thread_new() when the thread is created.
* Note: If this task priority is modified, please update the comment in nlenvironment-common.h
*/
#define TCPIP_THREAD_PRIO ((NLER_TASK_PRIORITY_HIGHEST)-4) //5
#define TCP_LISTEN_BACKLOG (1)
/**
* The WICED definition of PBUF_POOL_BUFSIZE includes a number of
* sizeof() instantiations which causes the C preprocessor to
* fail. Disable TCP configuration constant sanity checks to work
* around this.
*/
#define LWIP_DISABLE_TCP_SANITY_CHECKS (1)
/**
* The maximum of all used hardware address lengths across all types
* of interfaces in use:
*
* - 802.11 : 6
* - 802.15.4 : 8
*/
#define NETIF_MAX_HWADDR_LEN 8U
#define LWIP_NOASSERT 1
/**
* LWIP_IPV6_FORWARD==1: Forward IPv6 packets across netifs
*/
#define LWIP_IPV6_FORWARD 1
#endif /* ifdef CUSTOM_LWIPOPTS */
/*
* LWIP_IPV6_FORWARD==1: Enable IPv6 forwarding.
*/
#ifndef LWIP_IPV6_FORWARD
#define LWIP_IPV6_FORWARD 1
#endif
/**
* LWIP_IPV6_ROUTE_TABLE_SUPPORT==1: Enable support for a static routing table and refering
* these during forwarding.
*/
#ifndef LWIP_IPV6_ROUTE_TABLE_SUPPORT
#define LWIP_IPV6_ROUTE_TABLE_SUPPORT 1
#endif
#endif /* __T2_LWIPOPTS_H__ */