lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] RE: is this a reentrancy problem with LWIP ver


From: David Empson
Subject: Re: [lwip-users] RE: is this a reentrancy problem with LWIP ver
Date: Tue, 07 Sep 2010 12:04:10 +1200


"shogun" <address@hidden> wrote:

Your assumption is correct about the performance it less than I expected.
Sending a data block 2894 bytes every 200mS is 14.5kBytes/sec and it works
at that rate. It appears the fastest I can send that block of data is about every 100mS and that is about 28.9k Bytes per second. If I try to send the
2894 byte block every 90mS the send starts failing after 3-4 sends and the
send returns an out of memory error. At 90mS, that is only 25.7kBytes/sec.
These rates should be easy for a 10MBit connection and I am running a
100MBit connection.  I know the CPU can affect the performance but I am
running a 32 bit arm Cortex M# at 80MHz.  Is this typical performance from
lwip on a TCPIP connection?

I can't comment on expected performance for your platform (I would expect it to be higher), but there may be other factors influencing your throughput.

Two major factors will be the window size being offered by the receiver, and the amount of buffer space and send queue length in LWIP. If the other device starts by offering a small window, then you will only be able to send as much data as that window before LWIP will have to stop sending and wait for an acknowledgement to arrive. At this point, if you keep supplying transmit data to LWIP, it will be filling its buffers while unable to send anything. If you haven't configured LWIP to allow sufficient buffered transmit data then this will result in out of memory errors.

After a TCP connection is established, it may take a little while for it to stabilise with a steady flow of data, so the problem may be as simple as increasing the relevant buffers to allow LWIP to hold more data at the start of the connection.

The only information you have supplied so far showing the data transmission pattern implies your device can send 2894 bytes in three packets within approximately 200 microseconds. That's about 14 MB/s but only in a short burst.

We may be able to provide more specific help if you could attach a wireshark capture which shows the case where you are trying to send data every 90 ms and errors are occurring. A copy of your lwipopts.h file might also provide some relevant clues.

On another note, what do I have to be careful of in regards to lwip not
being reentrant?

If you are using the sockets or netconn API, don't use the same socket or netconn from multiple threads. If you are using the raw API, don't allow the LWIP core to be invoked from two threads (or from an interrupt handler and main code simultaneously).




reply via email to

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