lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Memory management for packet buffers


From: address@hidden
Subject: Re: [lwip-users] Memory management for packet buffers
Date: Wed, 24 Aug 2011 19:34:21 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20110624 Thunderbird/5.0

Mason wrote:
I'm not sure how to do this within the pbuf infrastructure?
Normally, for a DMA-enabled MAC, you would just pre-allocate 120 PBUF_POOL pbufs (each 1536 bytes big) and pass the payload pointer to the DMA engine. By substracting the difference between 'struct pbuf' and its member 'payload', you can then later get the pbuf pointer from the buffer pointer. (This is for RX.)

You don't need custom pbufs for that unless you need the memory to be located at specific addresses. You can even make the PBUF_POOL pbufs bigger than needed and manually adjust its length after allocation so that you can put private data into the allocated memory that is not used by the pbuf's payload (although that rather counts as a hack, then).
(I can't mask interrupts just because the network stacks needs a block of memory, or because multiple threads are using the socket layer.)
That depends. I bet the maximum interrupt-disable-time (i.e. interrupt latency) won't be lengthened by lwIP (SYS_ARCH_PROTECT is only used around small code bits), only frequency of interrupt-disable will increase.

After all, you don't need to globally disable all interrupts, disabling the interrupts that use lwIP is enough (i.e. only disable the MAC interrupt).

Simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]