lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] PBUF_RAM allocation


From: Simon Goldschmidt
Subject: Re: [lwip-users] PBUF_RAM allocation
Date: Thu, 28 Jun 2018 14:26:34 +0200

"Amena El Homsi" wrote:
> For PBUF_RAM type, LwIP mentions that "struct pbuf and its payload are
> allocated in one piece of contiguous memory (so the first payload byte
> can be calculated from struct pbuf)."
> 
> What If the pbuf structure is in place and the payload is in another
> place (non-contiguous)? Is there any issue if I allocate the pbuf structure
> from the pools and I set p->payload to point to the data in the frame memory?

Yes. The parts in lwIP that are coded with the above assumption will stop 
working
and you will get all kinds of bogus memory errors.
 
> [..]
> I updated pbuf_alloc(), when the type is PBUF_RAM, to allocate a pbuf stucture
> only from the lwIP pools, and calls the MMU to allocate memory to the frame,
> then I set p->payload to the frame pointer.

Why to people think the core files need modification? Why don't you indstead
search the list archive for people with similar problems?

Allocating a PBUF_REF or PBUF_ROM is what you want. PBUF_RAM allocates heap 
memory.

Simon



reply via email to

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