lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Understanding pbuf's


From: Martin Osterloh
Subject: Re: [lwip-users] Understanding pbuf's
Date: Tue, 17 Apr 2012 12:40:39 -0400

Bill,

Thanks for your reply. I am currently also using a generic queue to store pointers to pbufs.
But I still don't understand how this correlates to "pre-allocation".

Maybe, I misunderstand the meaning but I do not allocate any pbufs. All I have is a queue of pbuf pointers. In the ISR, all I can do is then update the reference to the newly received frame's payload. 

What am I missing something?

Thanks again,
-Martin

On Tue, Apr 17, 2012 at 10:46 AM, Bill Auerbach <address@hidden> wrote:

>I was also wondering: To pre-allocate pbufs, do I have to that in pbuf_init() (which is currently empty) or does LwiP take care of that internally? 

 

I create an array of pbuf pointers in ethernetif_init.  The ISR adds a RX packet to a pbuf next  in line in the array using a circular queue using the array index in and out slot.  Then my low_level_input (which is polled in my case) removes the new RX pbuf(s) and uses pbuf_alloc to replace it/them.  I then return the new RX pbuf.  lwIP will free this packet when it’s done.  The size of the array depends on how much memory you want to tie up in pbufs as they will always be allocated for keeping the array full.

 

 


_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users


reply via email to

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