[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mbuf allocate customisation
- Date: Wed, 24 May 2006 11:10:06 +1100
- From: sjohnson at sakuraindustries.com (Steven Johnson)
- Subject: mbuf allocate customisation
Hi Eric, Joel and list,
Attached is my hopefully, final customisable mbuf allocator patch. I've
tested it in my code, and it seems to work. My latest fundamental
problem lay with autotools stuff and my meagre understanding. But I
think its resolved, and now should build OK with the existing behaviour
(dynamic allocation) if it isn't customised by the user. The patch
contains my changes to "cpukit/libnetworking/Makefile.am" and the
changes to the autogenerated "cpukit/libnetworking/Makefile.in" so that
it can be built, after application of the patch (without requiring a
re-run of bootstrap).
To override mbuf allocation, a user #includes "rtems_bsdnet.h" and then
creates there own "malloc_mbuf" function, which is like malloc, but it
also passes a "type" of mbuf being allocated, so the code can be smart
about what it returns. The types are constants:
#define MBUF_MALLOC_NMBCLUSTERS (0)
#define MBUF_MALLOC_MCLREFCNT (1)
#define MBUF_MALLOC_MBUF (2)
are defined in "rtems_bsdnet.h" so a user implementation can reference them.
There is a new file "rtems_malloc_mbuf.c" which declares the default
dynamic allocator (calling malloc). The changes to rtems_glue.c simply
consist of replacements from malloc calls to calls to "malloc_mbuf".
If this is integrated, ill put a page in the wiki, showing how to do
static allocation with it (from my code which does it).
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 10802 bytes
Desc: not available
Url : http://rtems.rtems.org/pipermail/rtems-users/attachments/20060524/75b8e249/attachment.bin