lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] communications failing due to large packetsize?


From: Kieran Mansley
Subject: Re: [lwip-users] communications failing due to large packetsize?
Date: Fri, 08 Dec 2006 10:26:51 +0000

On Fri, 2006-12-08 at 11:11 +0100, Frans Moeskops wrote:
> Dear LWIP users,
> 
> I am using the lwip 1.1.1 on two embedded applications. They talk to
> eachother and read/write to FIFO's. The pbufs are chopped up to 2 bytes on
> the sending-end. When I send 1350 bytes everything goes well, but 30 bytes
> more and it fails.

Sounds like it's OK when everything fits in one segment, but not when
two are needed, although with your MSS size set at 1460 I'd expect the
point at which it fails to be a bit closer to that than 1350 bytes.

>   The debug (and ethereal) both say 'packet discarded due
> to failing checksum' and then my connection is broken. The receiver-side
> isn't acking the failed package, so my senders' queue is only growing. I'm
> new in the TCP/IP world so I'm a bit clueless about where to look.

I'd look at the checksum generation as a first check.  

> I use these defines:
> 
> #define MEM_SIZE                              2*1024*1024
> #define TCP_MSS                               1460
> #define TCP_SND_BUF                           2*1024*1024

I think I'd define TCP_SND_BUF to be a little less than MEM_SIZE so that
not all the memory can be in the send buffer, leaving none for receive.
A 2MB send buffer is very large - I think linux defaults to about 64KB
for the send and receive buffer lengths, although obviously you can set
them higher if you need to for performance.

> #define TCP_SND_QUEUELEN                      2*1024*1024

The send queuelen is the length in packet buffers, not bytes!

> #define MEMP_NUM_TCP_SEG                      2*1024
> #define MEMP_NUM_PBUF                         16

You've got 2048 TCP segments, but only 16 packet buffers to put them in.
These should I think be roughly similar values as often you'll have just
one segment in each packet buffer.

> #define TCP_WND                               4*1024

TCP_WND is the receive equivalent of the send buffer, so it makes sense
to set these roughly the same, and probably sensible to specify them
both as multiples of TCP_MSS.

> #define WND_OFFSET                            633

Not sure what this one is/does - it's not a standard option as far as I
can see.

Hope that helps.

Feel free to attach an ethereal capture if you think that would help
throw light on the problem but sounds as though the checksumming is
worth looking into first.

Kieran






reply via email to

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