[Top][All Lists]

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

Re: [lwip-users] Why so many pbufs required?

From: Kieran Mansley
Subject: Re: [lwip-users] Why so many pbufs required?
Date: Thu, 13 Aug 2009 14:22:57 +0100

On Thu, 2009-08-13 at 04:09 -0700, JM wrote:
> Maybe this is a dumb question, but I've been wondering this for
> awhile.  Why does PBUF_POOL_SIZE have to be so large?  It's been
> recommended to set it at 16 or more.  Say I have MSS set to the
> maximum of 1460, TCP_WND is set to 2*MSS, and PBUF_POOL_BUFSIZE is
> about 1520.  In this case, if less than 3KB of data can be in flight
> at a time, and I have no more than one connection at a time, why would
> I need anymore than about 3 or 4 pbufs if they are for Rx only?  

You're assuming that the stack will only receive packets for your
application.  In most networks this is not true - there will be a fair
number of broadcasts, and other stuff that your application will never
see.  These will still be passed to the stack, and each will use (at
least) one PBUF_POOL pbuf.  There may be other things, such as TCP ACKs
for any data you send, that also come in as separate packets and each
use PBUF_POOL pbufs.

Chris's point about using more-but-smaller pbufs in the pool is a good
one.  It will mean you might get away with less memory and fewer dropped
packets, at the cost of a little extra overhead for the chaining.


reply via email to

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