Commit Graph

124 Commits

Author SHA1 Message Date
Axel Lin
1a7ba24d13 memp: Fix memp_overflow_check_all failure
p needs to point to LWIP_MEM_ALIGN(memp_pools[i]->base) otherwise it will cause
assertion in overflow checking.

Fixes: c838e1ed5b ("Implement possibility to declare private memory pools")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-11-04 20:16:24 +01:00
Erik Ekman
a82ec4499f memp: Check for null in memp_free
When memp_free_pool was split out from memp_free (c838e1ed5b),
the check for freeing the null pointer was lost.

This resulted in the null value being put back in the list of free
objects, causing all subsequent allocations of that type to fail.
2016-11-03 12:17:01 +01:00
Axel Lin
db6aa82a10 memp: Fix comment for memp_overflow_check_element_overflow/underflow
These functions now take desc rather than memp_type as second parameter.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-08-28 20:33:57 +02:00
Axel Lin
b3bae1b44c memp: Fix unused variable build error when MEMP_SANITY_REGION_BEFORE/AFTER is 0
MEMP_SANITY_REGION_BEFORE and MEMP_SANITY_REGION_AFTER can be overridden in
lwipopts.h, if one of it is set to 0 we got build error due to unused variable.

Fix unused variable build error when MEMP_OVERFLOW_CHECK >= 1 &&
(MEMP_SANITY_REGION_BEFORE == 0 || MEMP_SANITY_REGION_AFTER == 0).

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2016-08-19 13:47:37 +02:00
goldsimon
55d05092ef simplify memp.c code a bit 2016-08-19 12:25:48 +02:00
Axel Lin
0e9ef19cfb memp: Remove memp_overflow_init() function
There is only one caller using memp_overflow_init(), and at that context
calling memp_overflow_init_element() actually simplifes the code.
Thus remove memp_overflow_init() function.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2016-08-19 12:25:47 +02:00
Axel Lin
e24fde05db memp: Fix memp_overflow_check_element_overflow assertion
Use LWIP_MEM_ALIGN() in memp_overflow_init() to get alignment address for memp.
This fixes assertion in memp_overflow_check_element_overflow when
MEMP_OVERFLOW_CHECK is set.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-08-18 19:24:34 +02:00
Axel Lin
ef31afb921 memp: Fix build error when LWIP_HOOK_MEMP_AVAILABLE is defined
Fix below build error.

../../../../../lwip/src/core/memp.c: In function ‘memp_free’:
../../../../../lwip/src/core/memp.c:490:31: error: request for member ‘tab’ in something not a structure or union
   old_first = memp_pools[type].tab;
                               ^
../../Common.mk:94: recipe for target 'memp.o' failed
make: *** [memp.o] Error 1

Fixes: de9054cb7a ("memp: cleaned up MEMP_MEM_MALLOC")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-08-18 19:20:26 +02:00
Dirk Ziegelmeier
8d07629b71 Some documentation cleanups and include more comments that have been already in code into doxygen docs 2016-08-07 10:05:34 +02:00
Dirk Ziegelmeier
70927892e1 Fix doxygen warning about debug parameters in memp.c
Remove documentation from them, it is not important
2016-07-27 20:34:23 +02:00
goldsimon
af97f9b239 fixed gcc compiler error in do_memp_free_pool(): obviously, SYS_ARCH_DECL_PROTECT() must be the last declaration... 2016-07-27 08:26:42 +02:00
Dirk Ziegelmeier
c6831648e2 Document apps in doxygen module style, create more top-level categories to structure documentation 2016-07-26 19:30:05 +02:00
Dirk Ziegelmeier
bd79f6c055 Document DNS, memory pools and PBUFs as modules 2016-07-26 16:40:13 +02:00
goldsimon
e030118750 moved MEM_LIBC_MALLOC code from mem.h to mem.c:
- it's not worth littering mem.h just to save some bytes to prevent the additional call;
- MEM_STATS now also work when MEM_LIBC_MALLOC is enabled
2016-07-26 15:02:36 +02:00
goldsimon
168ad22761 fixed custom pools after last memp cleanup 2016-07-26 12:26:52 +02:00
sg
de9054cb7a memp: cleaned up MEMP_MEM_MALLOC:
- support memp stats when MEMP_MEM_MALLOC==1 (bug #48442);
- hide MEMP_MEM_MALLOC in memp.c instead of messing up the header file;
- make MEMP_OVERFLOW_CHECK work when MEMP_MEM_MALLOC==1
2016-07-21 22:17:32 +02:00
Dirk Ziegelmeier
5d4c1432c2 Fix bug #48436: Naming clash for timers.c (with FreeRTOS)
Rename timers.* to timeouts.*
2016-07-19 12:44:12 +02:00
Dirk Ziegelmeier
72208cddfa Rename ip_frag.* to ip4_frag.* 2016-07-19 10:12:56 +02:00
Dirk Ziegelmeier
7037b340c1 Move etharp to core/ipv4, which is a more appropriate place for it 2016-07-19 09:29:51 +02:00
Dirk Ziegelmeier
4ea1d62d45 Update some doxygen comments 2016-07-16 17:56:29 +02:00
Dirk Ziegelmeier
01e5d6d819 memp.c: No need to init variables located in BSS section 2016-07-08 11:44:28 +02:00
goldsimon
6293a835e9 fixed compiling: forgot to move one line :-( 2016-07-08 10:16:46 +02:00
goldsimon
2df636fe77 memp: fixed STATS initialization 2016-07-08 10:06:36 +02:00
goldsimon
959042aa88 memp: fixed compiling various combinations of memp stats (display etc.) 2016-07-08 08:21:57 +02:00
Dirk Ziegelmeier
212eacd9d6 Fix bug #48356: private memp pools have no statistic counters
Implement struct stats_mem instance for each pool, let lwip_stats.mem[] point to these instances
2016-07-07 21:55:51 +02:00
goldsimon
14ca418ac0 minor: coding style fixes 2016-07-05 07:36:51 +02:00
Dirk Ziegelmeier
bb908366a5 More PPP cleanups 2016-04-25 20:08:29 +02:00
Dirk Ziegelmeier
73d8f14ebd Fix compile when PPP is not enabled 2016-04-25 20:08:29 +02:00
Dirk Ziegelmeier
ffa340a68c task #13907: PPP cleanups: Move PPP mempools out of lwIP core to PPP code 2016-04-25 20:08:29 +02:00
Dirk Ziegelmeier
a212210c35 Add missing #include in memp.c 2016-03-08 19:53:01 +01:00
Dirk Ziegelmeier
24bc77a935 Found some struct instances that can be const 2016-02-16 22:31:59 +01:00
Axel Lin
70ebeda7ed memp: Simplify implementation of memp_overflow_check_all
We don't really care the order of overflow/underflow checking because if
any checking fails we got assertion.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-15 11:38:02 +01:00
Axel Lin
a21144b834 memp: Fixup LWIP_HOOK_MEMP_AVAILABLE() hook
I got below build warning if LWIP_HOOK_MEMP_AVAILABLE is defined.

src/core/memp.c: In function 'memp_free_pool':
src/core/memp.c:352:16: warning: variable 'old_first' set but not used [-Wunused-but-set-variable]
   struct memp *old_first;
                ^
src/core/memp.c: In function 'memp_free':
src/core/memp.c:413:6: warning: 'old_first' may be used uninitialized in this function [-Wmaybe-uninitialized]
   if (old_first == NULL) {

The LWIP_HOOK_MEMP_AVAILABLE() hook does not work, fix it.

Fixes: c838e1ed5b ("Implement possibility to declare private memory pools")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-05 21:32:14 +01:00
Axel Lin
5c27429958 memp: Fix if MEMP_OVERFLOW_CHECK guard in memp_free_pool
Current code already checks memp_overflow_check_all() in memp_free() if
MEMP_OVERFLOW_CHECK >= 2. So in memp_free_pool(), it should use
MEMP_OVERFLOW_CHECK == 1 instead.

Fixes: c838e1ed5b ("Implement possibility to declare private memory pools")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-11-19 22:06:42 +01:00
Axel Lin
9c6708513a Drop unnecessary NULL test for h->next->next in memp_sanity
The h will point to NULL if h->next->next is NULL anyway.
So remove the unnecessary NULL test for h->next->next in each iteration.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-11-19 07:23:55 +01:00
Dirk Ziegelmeier
5f642eb3e3 Completely decouple SNMP stack from lwIP core by using private memory pools;
Move SNMP stack to apps;
API breaking change: Users need to call snmp_init() now!
2015-11-12 21:21:14 +01:00
Dirk Ziegelmeier
c838e1ed5b Implement possibility to declare private memory pools. This is useful to decouple some apps from the core (SNMP stack) or make contrib app useage simpler (httpserver_raw) . 2015-11-12 08:45:04 +01:00
sg
c12fa7b4c4 started to move "private" header files containing implementation details to "lwip/priv/" include directory to seperate the API from the implementation. 2015-10-09 21:58:58 +02:00
sg
2b971400fa minor: coding style 2015-10-06 21:57:40 +02:00
sg
22df34fc70 minor/coding style: removed spaces before line ending (from file header) 2015-10-06 21:13:15 +02:00
sg
490581a0eb minor/coding style: removed spaces before line ending 2015-10-06 21:08:28 +02:00
Sylvain Rochet
ea205f2fcd PPP, add PPPoS CB for PPPoS private data
Created a new PPPoS CB going to have PPPoS private data, so allocating a
PPPoE or a PPPoL2TP interface does not allocate as well PPPoS variables.
2015-02-17 23:22:13 +01:00
sg
b5b5844119 added hook LWIP_HOOK_MEMP_AVAILABLE() to get informed when a memp pool was empty and an item is now available 2015-02-13 21:53:55 +01:00
goldsimon
338feef70e memp: also export memp_sizes[] if MEMP_USE_CUSTOM_POOLS==1 2015-02-10 15:18:14 +01:00
Simon Goldschmidt
1fd4b851f5 Moved #define NETDB_ELEM_SIZE from dns.h to netdb.h, where it belongs, and use sizeof() instead of hacked constants that are wrong on 64-bit platforms 2014-09-02 21:27:24 +02:00
Sylvain Rochet
d7ba4bbb9b Merge branch 'master' into ppp-new 2014-02-21 00:39:29 +01:00
Simon Goldschmidt
e2c2afbbe0 patch #7885: modification of api modules to support FreeRTOS-MPU (don't pass stack-pointers to other threads) (based on patch by Artem Pisarenko) 2014-02-20 19:50:17 +01:00
Sylvain Rochet
bf37afd7c7 Merge branch 'master' into ppp-new 2014-01-12 15:05:37 +01:00
Simon Goldschmidt
75f2c56558 bug #41188 Alignment error in memp_init() when MEMP_SEPARATE_POOLS==1 2014-01-10 21:26:28 +01:00
Sylvain Rochet
4928166593 Merge branch 'master' into ppp-new 2012-08-23 20:51:53 +02:00