mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-22 07:21:30 +00:00
Converted runtime-sanity-checks into compile-time checks that can be disabled (since runtime checks can often not be seen on embedded targets)
This commit is contained in:
parent
81a49a437a
commit
c951ab8cee
@ -6,6 +6,10 @@ HISTORY
|
|||||||
|
|
||||||
++ New features:
|
++ New features:
|
||||||
|
|
||||||
|
2011-09-21: Simon Goldschmidt
|
||||||
|
* init.c: Converted runtime-sanity-checks into compile-time checks that can
|
||||||
|
be disabled (since runtime checks can often not be seen on embedded targets)
|
||||||
|
|
||||||
2011-09-11: Simon Goldschmidt
|
2011-09-11: Simon Goldschmidt
|
||||||
* ppp.h, ppp_impl.h: splitted ppp.h to an internal and external header file
|
* ppp.h, ppp_impl.h: splitted ppp.h to an internal and external header file
|
||||||
to get a clear separation of which functions an application or port may use
|
to get a clear separation of which functions an application or port may use
|
||||||
|
@ -237,35 +237,48 @@
|
|||||||
#error "ETHARP_ALWAYS_INSERT option is deprecated. Remove it from your lwipopts.h."
|
#error "ETHARP_ALWAYS_INSERT option is deprecated. Remove it from your lwipopts.h."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LWIP_DEBUG
|
#ifndef LWIP_DISABLE_TCP_SANITY_CHECKS
|
||||||
static void
|
#define LWIP_DISABLE_TCP_SANITY_CHECKS 0
|
||||||
lwip_sanity_check(void)
|
#endif
|
||||||
{
|
#ifndef LWIP_DISABLE_MEMP_SANITY_CHECKS
|
||||||
/* Warnings */
|
#define LWIP_DISABLE_MEMP_SANITY_CHECKS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* MEMP sanity checks */
|
||||||
|
#if !LWIP_DISABLE_MEMP_SANITY_CHECKS
|
||||||
#if LWIP_NETCONN
|
#if LWIP_NETCONN
|
||||||
if (MEMP_NUM_NETCONN > (MEMP_NUM_TCP_PCB+MEMP_NUM_TCP_PCB_LISTEN+MEMP_NUM_UDP_PCB+MEMP_NUM_RAW_PCB))
|
#if MEMP_NUM_NETCONN > (MEMP_NUM_TCP_PCB+MEMP_NUM_TCP_PCB_LISTEN+MEMP_NUM_UDP_PCB+MEMP_NUM_RAW_PCB)
|
||||||
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: MEMP_NUM_NETCONN should be less than the sum of MEMP_NUM_{TCP,RAW,UDP}_PCB+MEMP_NUM_TCP_PCB_LISTEN\n"));
|
#error "lwip_sanity_check: WARNING: MEMP_NUM_NETCONN should be less than the sum of MEMP_NUM_{TCP,RAW,UDP}_PCB+MEMP_NUM_TCP_PCB_LISTEN. If you know what you are doing, define LWIP_DISABLE_MEMP_SANITY_CHECKS to 1 to disable this error."
|
||||||
|
#endif
|
||||||
#endif /* LWIP_NETCONN */
|
#endif /* LWIP_NETCONN */
|
||||||
|
#endif /* !LWIP_DISABLE_MEMP_SANITY_CHECKS */
|
||||||
|
|
||||||
|
/* TCP sanity checks */
|
||||||
|
#if !LWIP_DISABLE_TCP_SANITY_CHECKS
|
||||||
#if LWIP_TCP
|
#if LWIP_TCP
|
||||||
if (MEMP_NUM_TCP_SEG < TCP_SND_QUEUELEN)
|
#if MEMP_NUM_TCP_SEG < TCP_SND_QUEUELEN
|
||||||
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: MEMP_NUM_TCP_SEG should be at least as big as TCP_SND_QUEUELEN\n"));
|
#error "lwip_sanity_check: WARNING: MEMP_NUM_TCP_SEG should be at least as big as TCP_SND_QUEUELEN. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
|
||||||
if (TCP_SND_BUF < 2 * TCP_MSS)
|
#endif
|
||||||
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_SND_BUF must be at least as much as (2 * TCP_MSS) for things to work smoothly\n"));
|
#if TCP_SND_BUF < (2 * TCP_MSS)
|
||||||
if (TCP_SND_QUEUELEN < (2 * (TCP_SND_BUF/TCP_MSS)))
|
#error "lwip_sanity_check: WARNING: TCP_SND_BUF must be at least as much as (2 * TCP_MSS) for things to work smoothly. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
|
||||||
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_SND_QUEUELEN must be at least as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work\n"));
|
#endif
|
||||||
if (TCP_SNDLOWAT >= TCP_SND_BUF)
|
#if TCP_SND_QUEUELEN < (2 * (TCP_SND_BUF / TCP_MSS))
|
||||||
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_SNDLOWAT must be less than TCP_SND_BUF.\n"));
|
#error "lwip_sanity_check: WARNING: TCP_SND_QUEUELEN must be at least as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
|
||||||
if (TCP_SNDQUEUELOWAT >= TCP_SND_QUEUELEN)
|
#endif
|
||||||
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_SNDQUEUELOWAT must be less than TCP_SND_QUEUELEN.\n"));
|
#if TCP_SNDLOWAT >= TCP_SND_BUF
|
||||||
if (TCP_WND > (PBUF_POOL_SIZE*PBUF_POOL_BUFSIZE))
|
#error "lwip_sanity_check: WARNING: TCP_SNDLOWAT must be less than TCP_SND_BUF. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
|
||||||
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_WND is larger than space provided by PBUF_POOL_SIZE*PBUF_POOL_BUFSIZE\n"));
|
#endif
|
||||||
if (TCP_WND < TCP_MSS)
|
#if TCP_SNDQUEUELOWAT >= TCP_SND_QUEUELEN
|
||||||
LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_WND is smaller than MSS\n"));
|
#error "lwip_sanity_check: WARNING: TCP_SNDQUEUELOWAT must be less than TCP_SND_QUEUELEN. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
|
||||||
|
#endif
|
||||||
|
#if TCP_WND > (PBUF_POOL_SIZE * (PBUF_POOL_BUFSIZE - (PBUF_LINK_HLEN + PBUF_IP_HLEN + PBUF_TRANSPORT_HLEN)))
|
||||||
|
#error "lwip_sanity_check: WARNING: TCP_WND is larger than space provided by PBUF_POOL_SIZE * (PBUF_POOL_BUFSIZE - protocol headers). If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
|
||||||
|
#endif
|
||||||
|
#if TCP_WND < TCP_MSS
|
||||||
|
#error "lwip_sanity_check: WARNING: TCP_WND is smaller than MSS. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
|
||||||
|
#endif
|
||||||
#endif /* LWIP_TCP */
|
#endif /* LWIP_TCP */
|
||||||
}
|
#endif /* !LWIP_DISABLE_TCP_SANITY_CHECKS */
|
||||||
#else /* LWIP_DEBUG */
|
|
||||||
#define lwip_sanity_check()
|
|
||||||
#endif /* LWIP_DEBUG */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform Sanity check of user-configurable values, and initialize all modules.
|
* Perform Sanity check of user-configurable values, and initialize all modules.
|
||||||
@ -273,9 +286,6 @@ lwip_sanity_check(void)
|
|||||||
void
|
void
|
||||||
lwip_init(void)
|
lwip_init(void)
|
||||||
{
|
{
|
||||||
/* Sanity check user-configurable values */
|
|
||||||
lwip_sanity_check();
|
|
||||||
|
|
||||||
/* Modules initialization */
|
/* Modules initialization */
|
||||||
stats_init();
|
stats_init();
|
||||||
#if !NO_SYS
|
#if !NO_SYS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user