lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] (no subject)


From: Andrew Lukefahr
Subject: [lwip-users] (no subject)
Date: Tue, 04 Dec 2007 22:30:43 -0600
User-agent: Thunderbird 2.0.0.6 (X11/20071022)

Hi,

I'm trying to use the sequential API to read and write to several
sockets simultaneously.  I'm using FreeRTOS on an AT91SAM7X256 and a
fairly recent(~1 month ago) cvs version of lwip.  I'm trying to read in
data over several connections, parse out the useful data, and then send
data back out over several other connections.  The incoming connections
are only used for incoming data, and the outgoing connections are only
used for outgoing data.  None of the streams have much data flowing
though them, at most ~1KB/s.

I got it working pretty consistently with 3 incoming connections and 1-5
outgoing connections.  I found out I had to put a ~150ms delay on the
output loop in my write thread, otherwise lwip would lock up.  However,
now I need to add a fourth incoming connection.  With the addition of
the 4th incoming connection, lwip works for anywhere from a few seconds
to a few minutes before locking up.  It seems the more outgoing
connections that lwip is trying to service, the quicker the lockup,
however, even if there aren't any outgoing connections, eventually lwip
will still lock up.  I've been playing around with debugging, and so far
I cant find anything that stands out.  The last few lines of my debug
look like this...

LWIP:     tcp_receive: window update 1052
LWIP:     tcp_receive: dupack averted 77772192 77772083
LWIP:     tcp_receive: pcb->rttest 0 rtseq 6509 ackno 6510
... then there is a long pause, followed by....
LWIP:     memp_malloc: out of memory in pool TCPIP_MSG_INPKT
LWIP:     memp_malloc: out of memory in pool TCPIP_MSG_INPKT
LWIP:     memp_malloc: out of memory in pool TCPIP_MSG_INPKT
LWIP:     memp_malloc: out of memory in pool TCPIP_MSG_INPKT
LWIP:     memp_malloc: out of memory in pool TCPIP_MSG_INPKT
LWIP:     memp_malloc: out of memory in pool TCPIP_MSG_INPKT
LWIP:     memp_malloc: out of memory in pool TCPIP_MSG_INPKT
LWIP:     memp_malloc: out of memory in pool TCPIP_MSG_INPKT
LWIP:     memp_malloc: out of memory in pool TCPIP_MSG_INPKT
LWIP:     memp_malloc: out of memory in pool TCPIP_MSG_INPKT
LWIP:     memp_malloc: out of memory in pool TCPIP_MSG_INPKT
LWIP:     memp_malloc: out of memory in pool TCPIP_MSG_INPKT
LWIP:     memp_malloc: out of memory in pool PBUF_POOL

So, a few questions.  First, I know that lwip isn't thread safe. 
However, I'm wondering what I need to control with a semaphore or
mutex.  I've got 4 different recv functions in 4 different threads, and
a single write thread.  So I can't block for each one, otherwise only
one can be blocked in recv at a time, and it will have to timeout if
there isnt any data, which will take too long. Also, do I need to try to
serialize lwip if I'm only using each netconn for one directional data
flow?   (If each netconn is only being used for sending OR receiving,
not both )

Second, I assume that something is going wrong in netconn_recv().  I'm
also guessing that as it works fine with three recv's, but locks up with
four, it is mostly likely overwhelming a buffer with incoming data.  So,
my question is what buffer(s) should I look at increasing to see if that
helps?

Or is there something I'm missing?  Any debugging recommendations to
help nail down whats causing the error?

I can post my lwipopts.h and and send/recv code if anyone thinks that
will help.


Oh, and on a completely unrelated question, if FreeRTOS implements
malloc and free as pvPortMalloc and vPortFree, what would I need to
modify in lwip to get it to use FreeRTOS memory instead of its own?  I
assume I would need to define MEM_LIBC_MALLOC correctly, and redefine
mem_malloc and mem_free in mem.h?

Thanks


-- 
Andrew Lukefahr
address@hidden

Electrical and Computer Engineering
Univeristy of Missouri

Open Source, Open Minds


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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