menu "Memory Configurations"

config NET_MEM_ALIGNMENT
	int "Memory Alignment"
	default 4
	---help---
		should be set to the alignment of the CPU 4 byte alignment
		-> #define MEM_ALIGNMENT 4 2 byte alignment -> #define MEM_ALIGNMENT 2

config NET_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT
	bool "Allow Memory Free from Other Context"
	default n
	---help---
		Set this to 1 if you want to free PBUF_RAM pbufs (or call mem_free())
		from interrupt context (or another context that doesn't allow waiting for a semaphore).
		If set to 1, mem_malloc will be protected by a semaphore and SYS_ARCH_PROTECT,
		while mem_free will only use SYS_ARCH_PROTECT. mem_malloc SYS_ARCH_UNPROTECTs
		with each loop so that mem_free can run.

		ATTENTION: As you can see from the above description, this leads to dis-/ enabling
		interrupts often, which can be slow! Also, on low memory, mem_malloc can need longer.

		If you don't want that, at least for NO_SYS=0, you can still use the following functions
		to enqueue a deallocation call which then runs in the tcpip_thread context:

		pbuf_free_callback(p);
		mem_free_callback(m);

config NET_MEM_LIBC_MALLOC
	bool "Use System Malloc"
	default n
	---help---
		Use malloc/free/realloc provided by your C-library instead of
		the lwip internal allocator. Can save code size if you already use it.

config NET_MEMP_MEM_MALLOC
	bool "Use mem_malloc/mem_free for Memory Pool"
	default n
	---help---
		Use mem_malloc/mem_free instead of the lwip pool allocator.
		Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution speed
		(heap alloc can be much slower than pool alloc) and usage from interrupts (especially if
		your netif driver allocates PBUF_POOL pbufs for received frames from interrupt)!

		ATTENTION: Currently, this uses the heap for ALL pools (also for private pools,
		not only for internal pools defined in memp_std.h)!

if !NET_MEM_LIBC_MALLOC

config NET_MEM_USE_POOLS
	bool "Memory Alloc Through Pool"
	default n
	---help---
		Use an alternative to malloc() by allocating from a set of memory pools of various sizes.
		When mem_malloc is called, an element of the smallest pool that can provide
		the length needed is returned. To use this, MEMP_USE_CUSTOM_POOLS also has to be enabled.


config NET_MEM_SIZE
	int "Static Memory Size"
	depends on !NET_MEM_USE_POOLS
	default 1600
	---help---
		The size of the heap memory.
		If the application will send a lot of data that needs to be copied, this should be set high.

endif #!NET_MEM_LIBC_MALLOC

if !NET_MEMP_MEM_MALLOC

config NET_MEMP_OVERFLOW_CHECK
	int "Memory Pool Overflow Check"
	default 0
	range 0 2
	---help---
		memp overflow protection reserves a configurable amount of bytes before and after
		each memp element in every pool and fills it with a prominent default value.
		MEMP_OVERFLOW_CHECK == 0 no checking MEMP_OVERFLOW_CHECK == 1 checks each element
		when it is freed MEMP_OVERFLOW_CHECK >= 2 checks each element in every pool every time
		memp_malloc() or memp_free() is called (useful but slow!)

config NET_MEMP_SANITY_CHECK
	bool "Memory Pool Sanity Check"
	default n
	---help---
		Run a sanity check after each memp_free() to make sure that there are no cycles
		in the linked lists.

config NET_MEMP_SEPARATE_POOLS
	bool "Memory Pool Separate Pools"
	default n
	---help---
		To place memory pools in separate arrays. This may be used to place these pools
		into user-defined memory by using external declaration.

config NET_MEMP_NUM_PBUF
	int "Memory Pool Pbuf Size"
	default 16
	---help---
		The number of memp struct pbufs (used for PBUF_ROM and PBUF_REF).
		If the application sends a lot of data out of ROM (or other static memory),
		this should be set high.

config NET_MEMP_NUM_RAW_PCB
	int "Memory Pool Raw PCB Size"
	default 4
	depends on NET_RAW
	---help---
		Number of raw connection PCBs (requires the LWIP_RAW option)

config NET_MEMP_NUM_UDP_PCB
	int "Memory Pool UDP PCB Size"
	default 4
	depends on NET_UDP
	---help---
		The number of UDP protocol control blocks. One per active UDP "connection".
		(requires the LWIP_UDP option)

config NET_MEMP_NUM_TCP_PCB
	int "Memory Pool TCP PCB Size"
	default 5
	depends on NET_TCP
	---help---
		The number of simultaneously active TCP connections. (requires the LWIP_TCP option)

config NET_MEMP_NUM_TCP_PCB_LISTEN
	int "Memory Pool TCP PCB Listen"
	default 8
	depends on NET_TCP
	---help---
		The number of listening TCP connections. (requires the LWIP_TCP option)

config NET_MEMP_NUM_TCP_SEG
	int "Memory Pool TCP SEG Size"
	default 16
	depends on NET_TCP
	---help---
		The number of simultaneously queued TCP segments. (requires the LWIP_TCP option)

config NET_MEMP_NUM_REASSDATA
	int "Memory Pool IP Reassemble"
	default 5
	depends on NET_IP_REASSEMBLY
	---help---
		The number of IP packets simultaneously queued for reassembly (whole packets, not fragments!)

config NET_MEMP_NUM_FRAG_PBUF
	int "Memory Pool IP Fragment"
	default 15
	depends on NET_IP_FRAG
	---help---
		The number of IP fragments simultaneously sent (fragments, not whole packets!).
		This is only used with LWIP_NETIF_TX_SINGLE_PBUF==0 and only has to be > 1
		with DMA-enabled MACs where the packet is not yet sent when netif->output returns.

config NET_MEMP_NUM_ARP_QUEUE
	int "Memory Pool ARP Queue Size"
	default 30
	depends on NET_ARP_QUEUEING
	---help---
		The number of simultaneously queued outgoing packets (pbufs) that are waiting
		for an ARP request (to resolve their destination address) to finish.
		(requires the ARP_QUEUEING option)

config NET_MEMP_NUM_IGMP_GROUP
	int "Memory Pool IGMP Size"
	default 8
	depends on NET_IGMP
	---help---
		The number of multicast groups whose network interfaces can be members
		at the same time (one per netif - allsystems group -, plus one per netif membership).
		(requires the LWIP_IGMP option)

config NET_MEMP_NUM_SYS_TIMEOUT
	int "Memory Pool System Timeout"
	default 6
	---help---
		The number of simultaneously active timeouts.
		The default number of timeouts is calculated here for all enabled modules.
		The formula expects settings to be either '0' or '1'.

config NET_MEMP_NUM_NETBUF
	int "Memory Pool Netbuf Size"
	default 2
	depends on NET_NETCONN
	---help---
		The number of struct netbufs. (only needed if you use the sequential API, like api_lib.c)

config NET_MEMP_NUM_TCPIP_MSG_API
	int "Memory Pool LWIP API Message Size"
	default 8
	---help---
		The number of struct tcpip_msg, which are used for callback/timeout API communication.
		(only needed if you use tcpip.c)

config NET_MEMP_NUM_TCPIP_MSG_INPKT
	int "Memory Pool LWIP Message INPKT"
	default 8
	depends on !NET_TCPIP_CORE_LOCKING_INPUT
	---help---
		The number of struct tcpip_msg, which are used for incoming packets.
		(only needed if you use tcpip.c)

config NET_MEMP_NUM_SNMP_NODE
	int "Memroy Pool SNMP Node Size"
	default 50
	depends on NET_SNMP
	---help---
		The number of leafs in the SNMP tree.

config NET_MEMP_NUM_SNMP_ROOTNODE
	int "Memory Pool SNMP Root Node Size"
	default 30
	depends on NET_SNMP
	---help---
		The number of branches in the SNMP tree. Every branch has one leaf at least.

config NET_MEMP_NUM_SNMP_VARBIND
	int "Memory Pool SNMP Varbind Size"
	default 2
	depends on NET_SNMP
	---help---
		The number of concurrent requests (does not have to be changed normally)
		- 2 of these are used per request (1 for input, 1 for output)

config NET_MEMP_NUM_SNMP_VALUE
	int "Memory Pool SNMP Value Size"
	default 3
	depends on NET_SNMP
	---help---
		 The number of OID or values concurrently used (does not have to be changed normally)
		 3 of these are used per request (1 for the value read and 2 for OIDs - input and output)

config NET_MEMP_NUM_PPPOE_INTERFACES
	int "Memory Pool PPPOE Interfaces Size"
	default 1
	depends on NET_PPP_SUPPORT && NET_PPPOE_SUPPORT
	---help---
		The number of concurrently active PPPoE interfaces (only used with PPPOE_SUPPORT==1)

config NET_PBUF_POOL_SIZE
	int "Memory Pool Pbuf Pool Size"
	default 16
	---help---
		The number of buffers in the pbuf pool.


endif #!NET_MEMP_MEM_MALLOC



endmenu #"Memory Configurations"
