lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] lwIP hangs after sending to much data


From: Kieran Mansley
Subject: Re: [lwip-users] lwIP hangs after sending to much data
Date: Mon, 04 Jul 2011 11:17:53 +0100

On Mon, 2011-07-04 at 11:42 +0200, brak brak2 wrote:
> I write a server TCP/IP application with the lwIP stack. I have this
> application for two microcontrollers. Basically application is the
> same on two microcontrollers (except lwIP port) and I facing the same
> problem on both of them. On the Stellaris LM3S6911 the problem was at
> the beginning of code writing but somehow it's gone (or hidden). On
> the LPC1769 the problem appears every time. Then I try to send too
> much data at a time transmission hangs. 

This is all rather confusing, and I think there might be more than one
problem, but a few things spring to mind:

1) if tcp_sndbuf() is returning >0, but you get ERR_MEM when trying to
send that many bytes, there's no point trying with a smaller number of
bytes.  It's probably an indication that there is some other limitation,
such as the number of buffers in the send queue, or the availability of
buffers.

2) You describe a problem with establishing a connection where lwIP
continues to reply with a SYN-ACK. Have you got a wireshark packet
capture of this case?  That would be very helpful in deciding what has
gone wrong.

3) Does you driver correct handle a list of pbufs?  In the cases where
you have more data queued up, lwIP might be sending a packet as a list
of pbufs, rather than a single one.  This has been a cause of problems
for others in the past.

4) Another possibility is that the packet lists in lwIP are getting
corrupted.  This is often caused by failing to respect lwIP's threading
constraints: i.e. only one thread active in the core of lwIP (including
interrupts) at one time.

5) For details of PBUF_LINK_HLEN and ETH_PAD_SIZE see
src/include/lwip/opt.h.  Your settings look wrong to me, and I would
leave them at the default unless you know otherwise.  The ETH_PAD_SIZE
defines how many bytes are unused at the start of the buffer, to ensure
that the subsequent (i.e. IP) headers are word-aligned.  The
PBUF_LINK_HLEN defines the size of the link-layer header, which for
Ethernet (with no VLANs or similar) is 14.

I hope that helps,

Kieran




reply via email to

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