lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] wrap rtos queue in lwip socket


From: Piero 74
Subject: Re: [lwip-devel] wrap rtos queue in lwip socket
Date: Thu, 25 Sep 2008 17:18:24 +0200

Hi Kieran.
I thought few days about your answer... (see below)
Now i understood how i can use loopif for my needs

As you said:
"3) Like 2, but Thread "A" reads your rtos queue and writes the data to a
loopback socket.  Thread "B" then uses select() to read both sources."

In my application i have some tasks devoted to manage packets from different source (network or uarts) depending the header in a packet, doing some protocol conversion.
So, i have ONLY one task to manage network sockets.
This task uses select to get data from multiple connection and dispatch to correct task using rtos queue (called TCPIP_TASK). When one of other task wants to send a packet to a connection, just sends it to TCPIP_TASK using a rtos queue. So, this is the reason of my problem: TCPIP_TASK has to use select for data from network and queue receive function for packet from other task.
There is an important thing i have to say: when TCPIP_TASK receives a packet, copies it in a shared memory, and sends to other task ONLY a pointer to packet (zero copy implementation)

If i'm right, i could use loopif in other tasks, to exchange data from other tasks and TCPIP_TASK, so, in this task a could use ONLY select (as you said)
But, in my mind, the exchanged data through loopif, will be again a pointer to packet in shared memory (4 bytes)
But i'm thinking... which protocol is it better to use?
I'm thinking UDP, i don't know differences with UDPLITE and i don't know RAW data....
can you suggest me which is the best???

Thanks in advice
Piero



2008/9/1 Kieran Mansley <address@hidden>
On Mon, 2008-09-01 at 16:02 +0200, Piero 74 wrote:
> FOR LWIP - RTOS users
>
> Hi all.
>
> I have a problem and an idea to solve it. I want discuss here about
> them.
>
> PROBLEM:
> i worked with lwip over an rtos.
> i have a task which can get data from network - i.e. a tcp socket - or
> from other task troght rtos queue.
> i want to work without blocking call, and i want short latency for
> data management on this task.
> now i dit something like this:

I don't really understand your proposed solution, but here are a number
of ways you could solve your problem:

1) Don't use the sockets API - if you use the raw API you'll get
callbacks when data become available.

2) Have more than one thread/task.  Thread "A" reads packets from the
network and writes them to a rtos queue.  Thread "B" reads both this new
rtos queue and the one you already have, and acts appropriately.

3) Like 2, but Thread "A" reads your rtos queue and writes the data to a
loopback socket.  Thread "B" then uses select() to read both sources.

4) Depending on what else you have to do, just poll the socket and the
rtos queue.

Kieran



_______________________________________________
lwip-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-devel


reply via email to

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