lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] MEMP_NUM_TCP_SEG setting


From: Kieran Mansley
Subject: Re: [lwip-users] MEMP_NUM_TCP_SEG setting
Date: Fri, 31 Aug 2007 08:59:07 +0100

On Thu, 2007-08-30 at 11:51 -0700, Siva Velusamy wrote:
> Hi,
> 
> I'm seeing the following issue with lwip-1.2.0 with a new port that
> I'm writing.
> 
> When doing a transmit test that keeps sending out maximum sized
> packets out to a host, for about 90 seconds I get consistent transmit
> throughput of ~ 94 Mbps. However after that tcp_write returns an
> error. Some more debugging reveals that at this point, lwIP runs out
> of memory for allocating TCP segments, and it fails in this line in
> tcp_out.c: 
> 
> /* Allocate memory for tcp_seg, and fill in fields. */
>     seg = memp_malloc(MEMP_TCP_SEG);
> 
> I've had to increase this parameter (MEMP_NUM_TCP_SEG - # of
> simultaneously queued TCP segments) all the way upto 64, but lwIP
> stats reports that all 64 are in use. Since I have a TCP_WND of only
> about 12k on host and 8k on the board, it somehow seems incorrect that
> there are 64 TCP segments queued up. 

Firstly, what is your TCP_MSS set to?  This will determine how large a
segment is, and so how many are required to hold a certain number of
bytes.

Secondly, TCP_WND controls how many bytes can be "in flight".  You also
need to consider how many bytes are queued waiting to be sent.  This is
controlled by TCP_SND_BUF (a value in bytes) and TCP_SND_QUEUELEN (a
additional limit in "packet buffers" to stop all of them being used on
the send queue leaving none for receive).  Assuming all your segments
are full size and the same settings are used at both ends, the total
number of segments required will be:

   (TCP_WND + TCP_SND_BUF) / TCP_MSS

Kieran





reply via email to

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