lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Problem with lwIP in seial-ethernet data transfer


From: Simon Goldschmidt
Subject: Re: [lwip-users] Problem with lwIP in seial-ethernet data transfer
Date: Sat, 19 Jul 2008 10:54:39 +0200

Hi,

>From your description, it seems like you call the tcp functions directly from 
>the 6 threads that handle the serial ports. If so, this is likely to be your 
>problem: the lwIP core (raw API, e.g. tcp_write, tcp_output, udp_send etc.) is 
>not protected against concurrent access. This means if you are using multiple 
>thread you either have to create one thread dedicated to use the core (like 
>the netconn/sockets API does with the tcpip_thread) or you have to manually 
>lock access to the core by creating a big mutex and lock it before accessing 
>stack-functions throughout your application (when calling the above tcp/udp 
>functions as well as when calling the input functions from your ethernet 
>driver).

This has already been confusing for many users, there is a description about 
using the raw API in the lwIP wiki at 
http://lwip.scribblewiki.com/Raw/native_API

Simon.

-------- Original-Nachricht --------
> Datum: Sat, 19 Jul 2008 01:57:55 +0530
> Von: "Vibhor Kapoor" <address@hidden>
> An: address@hidden
> Betreff: [lwip-users] Problem with lwIP in seial-ethernet data transfer

> Hi,
> 
> I'm working on ARM9 with Free RTOS as my OS and using lwIP stack. We have
> six serial ports on which continous data is coming which has to be
> transferred to UDP and TCP ports. Each of the six serial ports are mapped
> to
> six TCP ports.
> 
> Our problem is that the system performance starts to degrade after 4-5
> hrs.
> The TCP transmission stops at one port and then after a while on second
> port
> and like this on each interval. At this time our Telnet session which is
> our
> command interface also hangs. Until 4-5hrs everything works fine with no
> hangouts and data losses but then the above situations starts happening.
> 
> Our design is as follows:
> 
> For each serial port we have a seperate queue which gets filled in the
> UART
> interrupt and then a serial task(for respective serial port) retreives
> this
> data from the queue and fills it in it's local buffer.Ater predefined time
> or when a predefined value/amount of data is present we need to broadcast
> it
> and also send it to TCP. Hence we have in total 6 rx tasks and 6 queues
> for
> 6 serial ports.
> 
> On debugging we found that whenever the system starts hangs, the conrol is
> in dataaborthandler. I have kept all the checks in my application such
> that
> there is no overflow,Null pointer assignments or any memory leakage. I'm
> using tcp-write and tcp-output for TCP transmission.
> 
> The serial task has the folwowing flow:
> 
> 1. Check for the predefined(mentioned above0 conditions.
> 
> 2. If true enter loop else simply return.
> 
> 3. If true do tcp write and check for err_mem. If tcp-write returns no
> err,
> broadcast data on udp and call tcp-output. make local buffer index zero.
> 
> 4. if tcp-output returns error, check if the local buffer has reached its
> limit. If it has, then broad cast data and make and make local buffer
> index
> zero.
> 
> 5. If not, just return. Step 4 7 5 done so that we can avoid any loss of
> data on TCP,hoowever if local buffer is ful, we should atleast broadcast
> it.
> 
> I found out at many occasions that whenever my system hangs it doesn't
> complete the tcp-output function.
> 
> I tried to make changes in the lwipots.h but it didn't give any positive
> results.
> 
> can anyone help me in resolving this error or provide me with some useful
> changes or options that can be used.
> 
> Regards.

-- 
GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!
http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196




reply via email to

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