lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] HELP with LWIPOPTS.H - how set these options and what d


From: Jonathan Larmour
Subject: Re: [lwip-users] HELP with LWIPOPTS.H - how set these options and what does are they mean?
Date: Wed, 05 Mar 2008 14:43:07 +0000
User-agent: Thunderbird 1.5.0.12 (X11/20070530)

Piero 74 wrote:
> 
> I use  tcp (with listener) and udp sockets.
> 
> In particular, my questions are:
> 
> 1. MEMP_NUM_PBUF: comments are: used for PBUF_ROM and PBUF_REF. So, if i
> use, for both udp and tcp, only packet build in my buffer in ram, i can
> set this value low. IS IT RIGHT? 
>                                           sockets calls do copy of data,
> so, pbuf_rom and pbuf_ref are never used?

Not entirely. Sometimes PBUF_ROMs and PBUF_REFs are used internally in the
stack.

For example PBUF_ROMs are used in the tcp_enqueue function for data that
doesn't require copying.

PBUF_REFs are used by the BSD sockets API for sends (either directly or via
netbufs since it uses netbuf_ref() which allocates PBUF_REF pbufs), and IP
fragmentation code.

So if very much depends on your application.

> 2. MEMP_NUM_NETBUF: i set this value equal to sum of tcp connections and
> udp connections. IS IT RIGHT?

No. A netbuf is used as a wrapper for pbufs for communicating across the
netconn API. It is also therefore used inside the BSD sockets API
implementation.

> 3. MEMP_NUM_NETCONN:  i set this value equal to sum of tcp connections
> and udp connections and tcp listeners. IS IT RIGHT?

Yes, although be careful since connections are needed longer than you may
think, e.g. in the TIME_WAIT state, even after you think you have closed them.

> 4. MEMP_NUM_TCPIP_MSG_API and MEMP_NUM_TCPIP_MSG_INPKT: what does are
> they mean? how set these values? how they depends on tcp connections and
> udp connections?

Every API communication will require correspondence with the tcpip thread
using something from the MEMP_NUM_TCPIP_MSG_API pool. You can probably
consider it to be roughly the number of different threads potentially
performing tcpip stack accesses, but you probably need a few more than that
due to some internal uses in some circumstances.

MEMP_NUM_TCPIP_MSG_INPKT is a pool for messages indicating a new incoming
packet. If you run out of those, packets get dropped. The best value is
very dependent on your target's speed and peak level of traffic. Or perhaps
you don't mind packets getting dropped occasionally (versus the alternative
of higher memory use)/

> 5. PBUF_POOL_SIZE: i tryed to set this value low, but i saw problem with
> pbuf_alloc in my emac driver. What's the best or the minimal value for
> this option?

PBUF_POOL pbufs are mostly used for incoming packet data. Again depends on
traffic flow, and also how quickly your application will be processing
received data. Note there is also PBUF_POOL_BUFSIZE. Some drivers may
insist on PBUF_POOL_BUFSIZE being large enough to hold an entire ethernet
frame, but that's very inefficient.

> 6. xxx_RECVMBOX_SIZE: my sys_arch implementation creates mbox using
> param passed... so i set these values equal to 8. I understood that a
> mbox is created for EACH connection. IS IT RIGHT?

Yes.

> can i choose a low value if i will have packets
>                                                send to my board with low
> rate?

I imagine so.

> 7. DEFAULT_ACCEPTMBOX_SIZE: I understood that a mbox is created for EACH
> listener. So, if i want to accept only 2 connections for each listener,
> can i set this value equal than 2?

What Bill said about looking at the stats is definitely a good idea. That's
what it's there for, particularly the "max" fields. Of course you still
have to have an idea of what's going on in your application as you are
unlikely to have found the "worst case" when you run your app.

Jifl
-- 
eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["Si fractum non sit, noli id reficere"]------       Opinions==mine




reply via email to

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