Mistake on this page?
Report an issue in GitHub or email us
memp_std.h
Go to the documentation of this file.
1 /**
2  * @file
3  * lwIP internal memory pools (do not use in application code)
4  * This file is deliberately included multiple times: once with empty
5  * definition of LWIP_MEMPOOL() to handle all includes and multiple times
6  * to build up various lists of mem pools.
7  */
8 
9 /*
10  * SETUP: Make sure we define everything we will need.
11  *
12  * We have create three types of pools:
13  * 1) MEMPOOL - standard pools
14  * 2) MALLOC_MEMPOOL - to be used by mem_malloc in mem.c
15  * 3) PBUF_MEMPOOL - a mempool of pbuf's, so include space for the pbuf struct
16  *
17  * If the include'r doesn't require any special treatment of each of the types
18  * above, then will declare #2 & #3 to be just standard mempools.
19  */
20 #ifndef LWIP_MALLOC_MEMPOOL
21 /* This treats "malloc pools" just like any other pool.
22  The pools are a little bigger to provide 'size' as the amount of user data. */
23 #define LWIP_MALLOC_MEMPOOL(num, size) LWIP_MEMPOOL(POOL_##size, num, (size + LWIP_MEM_ALIGN_SIZE(sizeof(struct memp_malloc_helper))), "MALLOC_"#size)
24 #define LWIP_MALLOC_MEMPOOL_START
25 #define LWIP_MALLOC_MEMPOOL_END
26 #endif /* LWIP_MALLOC_MEMPOOL */
27 
28 #ifndef LWIP_PBUF_MEMPOOL
29 /* This treats "pbuf pools" just like any other pool.
30  * Allocates buffers for a pbuf struct AND a payload size */
31 #define LWIP_PBUF_MEMPOOL(name, num, payload, desc) LWIP_MEMPOOL(name, num, (LWIP_MEM_ALIGN_SIZE(sizeof(struct pbuf)) + LWIP_MEM_ALIGN_SIZE(payload)), desc)
32 #endif /* LWIP_PBUF_MEMPOOL */
33 
34 
35 /*
36  * A list of internal pools used by LWIP.
37  *
38  * LWIP_MEMPOOL(pool_name, number_elements, element_size, pool_description)
39  * creates a pool name MEMP_pool_name. description is used in stats.c
40  */
41 #if LWIP_RAW
42 LWIP_MEMPOOL(RAW_PCB, MEMP_NUM_RAW_PCB, sizeof(struct raw_pcb), "RAW_PCB")
43 #endif /* LWIP_RAW */
44 
45 #if LWIP_UDP
46 LWIP_MEMPOOL(UDP_PCB, MEMP_NUM_UDP_PCB, sizeof(struct udp_pcb), "UDP_PCB")
47 #endif /* LWIP_UDP */
48 
49 #if LWIP_TCP
50 LWIP_MEMPOOL(TCP_PCB, MEMP_NUM_TCP_PCB, sizeof(struct tcp_pcb), "TCP_PCB")
51 LWIP_MEMPOOL(TCP_PCB_LISTEN, MEMP_NUM_TCP_PCB_LISTEN, sizeof(struct tcp_pcb_listen), "TCP_PCB_LISTEN")
52 LWIP_MEMPOOL(TCP_SEG, MEMP_NUM_TCP_SEG, sizeof(struct tcp_seg), "TCP_SEG")
53 #endif /* LWIP_TCP */
54 
55 #if LWIP_ALTCP && LWIP_TCP
56 LWIP_MEMPOOL(ALTCP_PCB, MEMP_NUM_ALTCP_PCB, sizeof(struct altcp_pcb), "ALTCP_PCB")
57 #endif /* LWIP_ALTCP && LWIP_TCP */
58 
59 #if LWIP_IPV4 && IP_REASSEMBLY
60 LWIP_MEMPOOL(REASSDATA, MEMP_NUM_REASSDATA, sizeof(struct ip_reassdata), "REASSDATA")
61 #endif /* LWIP_IPV4 && IP_REASSEMBLY */
62 #if (IP_FRAG && !LWIP_NETIF_TX_SINGLE_PBUF) || (LWIP_IPV6 && LWIP_IPV6_FRAG)
63 LWIP_MEMPOOL(FRAG_PBUF, MEMP_NUM_FRAG_PBUF, sizeof(struct pbuf_custom_ref),"FRAG_PBUF")
64 #endif /* IP_FRAG && !LWIP_NETIF_TX_SINGLE_PBUF || (LWIP_IPV6 && LWIP_IPV6_FRAG) */
65 
66 #if LWIP_NETCONN || LWIP_SOCKET
67 LWIP_MEMPOOL(NETBUF, MEMP_NUM_NETBUF, sizeof(struct netbuf), "NETBUF")
68 LWIP_MEMPOOL(NETCONN, MEMP_NUM_NETCONN, sizeof(struct netconn), "NETCONN")
69 #endif /* LWIP_NETCONN || LWIP_SOCKET */
70 
71 #if NO_SYS==0
72 LWIP_MEMPOOL(TCPIP_MSG_API, MEMP_NUM_TCPIP_MSG_API, sizeof(struct tcpip_msg), "TCPIP_MSG_API")
73 #if LWIP_MPU_COMPATIBLE
74 LWIP_MEMPOOL(API_MSG, MEMP_NUM_API_MSG, sizeof(struct api_msg), "API_MSG")
75 #if LWIP_DNS
76 LWIP_MEMPOOL(DNS_API_MSG, MEMP_NUM_DNS_API_MSG, sizeof(struct dns_api_msg), "DNS_API_MSG")
77 #endif
78 #if LWIP_SOCKET && !LWIP_TCPIP_CORE_LOCKING
79 LWIP_MEMPOOL(SOCKET_SETGETSOCKOPT_DATA, MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA, sizeof(struct lwip_setgetsockopt_data), "SOCKET_SETGETSOCKOPT_DATA")
80 #endif
81 #if LWIP_SOCKET && (LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL)
82 LWIP_MEMPOOL(SELECT_CB, MEMP_NUM_SELECT_CB, sizeof(struct lwip_select_cb), "SELECT_CB")
83 #endif /* LWIP_SOCKET && (LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL) */
84 #if LWIP_NETIF_API
85 LWIP_MEMPOOL(NETIFAPI_MSG, MEMP_NUM_NETIFAPI_MSG, sizeof(struct netifapi_msg), "NETIFAPI_MSG")
86 #endif
87 #endif /* LWIP_MPU_COMPATIBLE */
88 #if !LWIP_TCPIP_CORE_LOCKING_INPUT
89 LWIP_MEMPOOL(TCPIP_MSG_INPKT,MEMP_NUM_TCPIP_MSG_INPKT, sizeof(struct tcpip_msg), "TCPIP_MSG_INPKT")
90 #endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */
91 #endif /* NO_SYS==0 */
92 
93 #if LWIP_IPV4 && LWIP_ARP && ARP_QUEUEING
94 LWIP_MEMPOOL(ARP_QUEUE, MEMP_NUM_ARP_QUEUE, sizeof(struct etharp_q_entry), "ARP_QUEUE")
95 #endif /* LWIP_IPV4 && LWIP_ARP && ARP_QUEUEING */
96 
97 #if LWIP_IGMP
98 LWIP_MEMPOOL(IGMP_GROUP, MEMP_NUM_IGMP_GROUP, sizeof(struct igmp_group), "IGMP_GROUP")
99 #endif /* LWIP_IGMP */
100 
101 #if LWIP_TIMERS && !LWIP_TIMERS_CUSTOM
102 LWIP_MEMPOOL(SYS_TIMEOUT, MEMP_NUM_SYS_TIMEOUT, sizeof(struct sys_timeo), "SYS_TIMEOUT")
103 #endif /* LWIP_TIMERS && !LWIP_TIMERS_CUSTOM */
104 
105 #if LWIP_DNS && LWIP_SOCKET
106 LWIP_MEMPOOL(NETDB, MEMP_NUM_NETDB, NETDB_ELEM_SIZE, "NETDB")
107 #endif /* LWIP_DNS && LWIP_SOCKET */
108 #if LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC
109 LWIP_MEMPOOL(LOCALHOSTLIST, MEMP_NUM_LOCALHOSTLIST, LOCALHOSTLIST_ELEM_SIZE, "LOCALHOSTLIST")
110 #endif /* LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
111 
112 #if LWIP_IPV6 && LWIP_ND6_QUEUEING
113 LWIP_MEMPOOL(ND6_QUEUE, MEMP_NUM_ND6_QUEUE, sizeof(struct nd6_q_entry), "ND6_QUEUE")
114 #endif /* LWIP_IPV6 && LWIP_ND6_QUEUEING */
115 
116 #if LWIP_IPV6 && LWIP_IPV6_REASS
117 LWIP_MEMPOOL(IP6_REASSDATA, MEMP_NUM_REASSDATA, sizeof(struct ip6_reassdata), "IP6_REASSDATA")
118 #endif /* LWIP_IPV6 && LWIP_IPV6_REASS */
119 
120 #if LWIP_IPV6 && LWIP_IPV6_MLD
121 LWIP_MEMPOOL(MLD6_GROUP, MEMP_NUM_MLD6_GROUP, sizeof(struct mld_group), "MLD6_GROUP")
122 #endif /* LWIP_IPV6 && LWIP_IPV6_MLD */
123 
124 
125 /*
126  * A list of pools of pbuf's used by LWIP.
127  *
128  * LWIP_PBUF_MEMPOOL(pool_name, number_elements, pbuf_payload_size, pool_description)
129  * creates a pool name MEMP_pool_name. description is used in stats.c
130  * This allocates enough space for the pbuf struct and a payload.
131  * (Example: pbuf_payload_size=0 allocates only size for the struct)
132  */
133 LWIP_MEMPOOL(PBUF, MEMP_NUM_PBUF, sizeof(struct pbuf), "PBUF_REF/ROM")
134 LWIP_PBUF_MEMPOOL(PBUF_POOL, PBUF_POOL_SIZE, PBUF_POOL_BUFSIZE, "PBUF_POOL")
135 
136 
137 /*
138  * Allow for user-defined pools; this must be explicitly set in lwipopts.h
139  * since the default is to NOT look for lwippools.h
140  */
141 #if MEMP_USE_CUSTOM_POOLS
142 #include "lwippools.h"
143 #endif /* MEMP_USE_CUSTOM_POOLS */
144 
145 /*
146  * REQUIRED CLEANUP: Clear up so we don't get "multiply defined" error later
147  * (#undef is ignored for something that is not defined)
148  */
149 #undef LWIP_MEMPOOL
150 #undef LWIP_MALLOC_MEMPOOL
151 #undef LWIP_MALLOC_MEMPOOL_START
152 #undef LWIP_MALLOC_MEMPOOL_END
153 #undef LWIP_PBUF_MEMPOOL
#define MEMP_NUM_TCPIP_MSG_API
MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used for callback/timeout API commu...
Definition: opt.h:550
#define MEMP_NUM_TCP_SEG
MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
Definition: opt.h:452
#define MEMP_NUM_SELECT_CB
MEMP_NUM_SELECT_CB: the number of struct lwip_select_cb.
Definition: opt.h:541
#define MEMP_NUM_ALTCP_PCB
MEMP_NUM_ALTCP_PCB: the number of simultaneously active altcp layer pcbs.
Definition: opt.h:462
#define MEMP_NUM_ARP_QUEUE
MEMP_NUM_ARP_QUEUE: the number of simultaneously queued outgoing packets (pbufs) that are waiting for...
Definition: opt.h:491
#define MEMP_NUM_REASSDATA
MEMP_NUM_REASSDATA: the number of IP packets simultaneously queued for reassembly (whole packets...
Definition: opt.h:470
#define MEMP_NUM_DNS_API_MSG
MEMP_NUM_DNS_API_MSG: the number of concurrently active calls to netconn_gethostbyname.
Definition: opt.h:595
#define MEMP_NUM_UDP_PCB
MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks.
Definition: opt.h:428
#define MEMP_NUM_PBUF
MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF).
Definition: opt.h:411
#define MEMP_NUM_FRAG_PBUF
MEMP_NUM_FRAG_PBUF: the number of IP fragments simultaneously sent (fragments, not whole packets!)...
Definition: opt.h:481
#define MEMP_NUM_API_MSG
MEMP_NUM_API_MSG: the number of concurrently active calls to various socket, netconn, and tcpip functions.
Definition: opt.h:589
#define PBUF_POOL_SIZE
PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
Definition: opt.h:582
#define MEMP_NUM_LOCALHOSTLIST
MEMP_NUM_LOCALHOSTLIST: the number of host entries in the local host list if DNS_LOCAL_HOSTLIST_IS_DY...
Definition: opt.h:575
Main packet buffer struct.
pbuf payload refers to RAM.
Definition: pbuf.h:167
#define MEMP_NUM_NETDB
MEMP_NUM_NETDB: the number of concurrently running lwip_addrinfo() calls (before freeing the correspo...
Definition: opt.h:567
#define MEMP_NUM_NETBUF
MEMP_NUM_NETBUF: the number of struct netbufs.
Definition: opt.h:524
#define MEMP_NUM_TCPIP_MSG_INPKT
MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used for incoming packets...
Definition: opt.h:559
#define MEMP_NUM_NETCONN
MEMP_NUM_NETCONN: the number of struct netconns.
Definition: opt.h:532
#define MEMP_NUM_RAW_PCB
MEMP_NUM_RAW_PCB: Number of raw connection PCBs (requires the LWIP_RAW option)
Definition: opt.h:419
#define PBUF_POOL_BUFSIZE
PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool.
Definition: opt.h:1548
#define MEMP_NUM_NETIFAPI_MSG
MEMP_NUM_NETIFAPI_MSG: the number of concurrently active calls to the netifapi functions.
Definition: opt.h:609
#define MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA
MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA: the number of concurrently active calls to getsockopt/setsockopt...
Definition: opt.h:602
#define MEMP_NUM_IGMP_GROUP
MEMP_NUM_IGMP_GROUP: The number of multicast groups whose network interfaces can be members at the sa...
Definition: opt.h:501
#define MEMP_NUM_ND6_QUEUE
MEMP_NUM_ND6_QUEUE: Max number of IPv6 packets to queue during MAC resolution.
Definition: opt.h:2554
#define MEMP_NUM_SYS_TIMEOUT
MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active timeouts.
Definition: opt.h:516
#define MEMP_NUM_MLD6_GROUP
MEMP_NUM_MLD6_GROUP: Max number of IPv6 multicast groups that can be joined.
Definition: opt.h:2531
#define MEMP_NUM_TCP_PCB
MEMP_NUM_TCP_PCB: the number of simultaneously active TCP connections.
Definition: opt.h:436
#define MEMP_NUM_TCP_PCB_LISTEN
MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
Definition: opt.h:444
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.