From 0167bbb89a5d08db0fe3db69d3d12f39233eeee5 Mon Sep 17 00:00:00 2001 From: marcbou Date: Fri, 17 Aug 2007 02:46:43 +0000 Subject: [PATCH] Per Frederic's suggestion, renamed [MEMP_[NUM_]]TCPIP_MSG to [MEMP_[NUM_]]TCPIP_MSG_API and [MEMP_[NUM_]]TCPIP_MSG_INPUT to [MEMP_[NUM_]]TCPIP_MSG_INPKT. Added defines in opt.h for temporary compatibility with older lwipopts.h. --- src/api/tcpip.c | 20 ++++++++++---------- src/core/memp.c | 8 ++++---- src/include/lwip/memp.h | 4 ++-- src/include/lwip/opt.h | 21 ++++++++++++++------- src/include/lwip/tcpip.h | 2 +- 5 files changed, 31 insertions(+), 24 deletions(-) diff --git a/src/api/tcpip.c b/src/api/tcpip.c index b71fb96d..9ef07b8b 100644 --- a/src/api/tcpip.c +++ b/src/api/tcpip.c @@ -313,10 +313,10 @@ tcpip_thread(void *arg) break; #if ETHARP_TCPIP_INPUT || ETHARP_TCPIP_ETHINPUT - case TCPIP_MSG_INPUT: + case TCPIP_MSG_INPKT: LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: PACKET %p\n", (void *)msg)); msg->msg.inp.f(msg->msg.inp.p, msg->msg.inp.netif); - memp_free(MEMP_TCPIP_MSG_INPUT, msg); + memp_free(MEMP_TCPIP_MSG_INPKT, msg); break; #endif /* ETHARP_TCPIP_INPUT || ETHARP_TCPIP_ETHINPUT */ @@ -330,7 +330,7 @@ tcpip_thread(void *arg) case TCPIP_MSG_CALLBACK: LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK %p\n", (void *)msg)); msg->msg.cb.f(msg->msg.cb.ctx); - memp_free(MEMP_TCPIP_MSG, msg); + memp_free(MEMP_TCPIP_MSG_API, msg); break; case TCPIP_MSG_TIMEOUT: LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: TIMEOUT %p\n", (void *)msg)); @@ -339,7 +339,7 @@ tcpip_thread(void *arg) sys_timeout (msg->msg.tmo.msecs, msg->msg.tmo.h, msg->msg.tmo.arg); else sys_untimeout (msg->msg.tmo.h, msg->msg.tmo.arg); - memp_free(MEMP_TCPIP_MSG, msg); + memp_free(MEMP_TCPIP_MSG_API, msg); break; default: break; @@ -360,12 +360,12 @@ tcpip_input(struct pbuf *p, struct netif *inp) struct tcpip_msg *msg; if (mbox != SYS_MBOX_NULL) { - msg = memp_malloc(MEMP_TCPIP_MSG_INPUT); + msg = memp_malloc(MEMP_TCPIP_MSG_INPKT); if (msg == NULL) { return ERR_MEM; } - msg->type = TCPIP_MSG_INPUT; + msg->type = TCPIP_MSG_INPKT; msg->msg.inp.f = ip_input; msg->msg.inp.p = p; msg->msg.inp.netif = inp; @@ -381,12 +381,12 @@ tcpip_input_callback(struct pbuf *p, struct netif *inp, err_t (*f)(struct pbuf * struct tcpip_msg *msg; if (mbox != SYS_MBOX_NULL) { - msg = memp_malloc(MEMP_TCPIP_MSG_INPUT); + msg = memp_malloc(MEMP_TCPIP_MSG_INPKT); if (msg == NULL) { return ERR_MEM; } - msg->type = TCPIP_MSG_INPUT; + msg->type = TCPIP_MSG_INPKT; msg->msg.inp.f = f; msg->msg.inp.p = p; msg->msg.inp.netif = inp; @@ -427,7 +427,7 @@ tcpip_callback(void (*f)(void *ctx), void *ctx) struct tcpip_msg *msg; if (mbox != SYS_MBOX_NULL) { - msg = memp_malloc(MEMP_TCPIP_MSG); + msg = memp_malloc(MEMP_TCPIP_MSG_API); if (msg == NULL) { return ERR_MEM; } @@ -447,7 +447,7 @@ tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg) struct tcpip_msg *msg; if (mbox != SYS_MBOX_NULL) { - msg = memp_malloc(MEMP_TCPIP_MSG); + msg = memp_malloc(MEMP_TCPIP_MSG_API); if (msg == NULL) { return ERR_MEM; } diff --git a/src/core/memp.c b/src/core/memp.c index fa9f66ff..b70b9d7e 100644 --- a/src/core/memp.c +++ b/src/core/memp.c @@ -141,8 +141,8 @@ static const u16_t memp_num[MEMP_MAX] = { MEMP_NUM_TCP_SEG, MEMP_NUM_NETBUF, MEMP_NUM_NETCONN, - MEMP_NUM_TCPIP_MSG, - MEMP_NUM_TCPIP_MSG_INPUT, + MEMP_NUM_TCPIP_MSG_API, + MEMP_NUM_TCPIP_MSG_INPKT, #if ARP_QUEUEING MEMP_NUM_ARP_QUEUE, #endif @@ -168,8 +168,8 @@ static u8_t memp_memory[MEM_ALIGNMENT - 1 + MEMP_TYPE_SIZE(MEMP_NUM_TCP_SEG, struct tcp_seg) + MEMP_TYPE_SIZE(MEMP_NUM_NETBUF, struct netbuf) + MEMP_TYPE_SIZE(MEMP_NUM_NETCONN, struct netconn) + - MEMP_TYPE_SIZE(MEMP_NUM_TCPIP_MSG, struct tcpip_msg) + - MEMP_TYPE_SIZE(MEMP_NUM_TCPIP_MSG_INPUT, struct tcpip_msg) + + MEMP_TYPE_SIZE(MEMP_NUM_TCPIP_MSG_API, struct tcpip_msg) + + MEMP_TYPE_SIZE(MEMP_NUM_TCPIP_MSG_INPKT, struct tcpip_msg) + #if ARP_QUEUEING MEMP_TYPE_SIZE(MEMP_NUM_ARP_QUEUE, struct etharp_q_entry) + #endif diff --git a/src/include/lwip/memp.h b/src/include/lwip/memp.h index 01078b28..217c5fb8 100644 --- a/src/include/lwip/memp.h +++ b/src/include/lwip/memp.h @@ -50,8 +50,8 @@ typedef enum { MEMP_NETBUF, MEMP_NETCONN, - MEMP_TCPIP_MSG, - MEMP_TCPIP_MSG_INPUT, + MEMP_TCPIP_MSG_API, + MEMP_TCPIP_MSG_INPKT, #if ARP_QUEUEING MEMP_ARP_QUEUE, #endif diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 54ca863b..eece3241 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -192,15 +192,22 @@ #ifndef MEMP_NUM_NETCONN #define MEMP_NUM_NETCONN 4 #endif -/* MEMP_NUM_TCPIPMSG: the number of struct tcpip_msg, which is used - for callback/timeout API communication. Used in src/api/tcpip.c. */ -#ifndef MEMP_NUM_TCPIP_MSG -#define MEMP_NUM_TCPIP_MSG 8 + +/* For temporary compatibility with older lwipopts.h */ +#if defined(MEMP_NUM_TCPIP_MSG) && !defined(MEMP_NUM_TCPIP_MSG_API) && !defined(MEMP_NUM_TCPIP_MSG_INPKT) +#define MEMP_NUM_TCPIP_MSG_API (MEMP_NUM_TCPIP_MSG / 2) +#define MEMP_NUM_TCPIP_MSG_INPKT (MEMP_NUM_TCPIP_MSG) #endif -/* MEMP_NUM_TCPIPMSG_INPUT: the number of struct tcpip_msg, which is used + +/* MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which is used + for callback/timeout API communication. Used in src/api/tcpip.c. */ +#ifndef MEMP_NUM_TCPIP_MSG_API +#define MEMP_NUM_TCPIP_MSG_API 4 +#endif +/* MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which is used for incoming packets. Used in src/api/tcpip.c. */ -#ifndef MEMP_NUM_TCPIP_MSG_INPUT -#define MEMP_NUM_TCPIP_MSG_INPUT MEMP_NUM_TCPIP_MSG +#ifndef MEMP_NUM_TCPIP_MSG_INPKT +#define MEMP_NUM_TCPIP_MSG_INPKT 8 #endif /* ---------- ARP options ---------- */ diff --git a/src/include/lwip/tcpip.h b/src/include/lwip/tcpip.h index 90de8532..0f373d74 100644 --- a/src/include/lwip/tcpip.h +++ b/src/include/lwip/tcpip.h @@ -87,7 +87,7 @@ err_t tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg); enum tcpip_msg_type { TCPIP_MSG_API, #if ETHARP_TCPIP_INPUT || ETHARP_TCPIP_ETHINPUT - TCPIP_MSG_INPUT, + TCPIP_MSG_INPKT, #endif /* ETHARP_TCPIP_INPUT || ETHARP_TCPIP_ETHINPUT */ #if LWIP_NETIF_API TCPIP_MSG_NETIFAPI,