[Top][All Lists]

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

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

From: Vibhor Kapoor
Subject: Re: [lwip-users] Problem with lwIP in seial-ethernet data transfer
Date: Sun, 20 Jul 2008 11:01:12 +0530

Thanks for the response. I read through the below link and fully agree that we need some locking mechanism for accessing the core.
However having six tasks and each task on getting scheduled call tcp-write and tcp-output with a different pcb and buffer(storing the data).
This may be preventing my system till now but we need to have a locking mechanism.
We call tcp-output just after tcp-write like this:
if(err != ERR_MEM)
We did so as we need to output continous data to TCP on all the six ports and if we let tcp_write do the processing , we were loosing the data, hence whenever tcp-write doesn't return error, we immediately output.
Please confirm if the above approach is fine and I  plan to put a lock before entering this section and then unlock once out of this section.
On Sat, Jul 19, 2008 at 2:24 PM, Simon Goldschmidt <address@hidden> wrote:

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


-------- 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
> 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!

lwip-users mailing list

reply via email to

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