lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Feeding incoming packets to lwIP


From: David Haas
Subject: Re: [lwip-users] Feeding incoming packets to lwIP
Date: Tue, 14 Jan 2003 17:06:38 -0500
User-agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.2b) Gecko/20021107

Dan,

I am using an interrupt-driven multi-threaded implementation. Yes, I did have some problems.

You need to watch for the protection in memp.c and pbuf.c. There are many areas which are not protected well and do need to be. In my case, I am using pbuf buffers in my ISR and I found I needed to add protection in order to do that. If you are calling tcpip_input from another thread you definitely will need to add this protection and I recommend added protection in memp.c as well.

Please look at patch 873. This code adds this protection in the form of disabling and enabling interrupts through function calls in sys_arch.c.

I have had very good luck since I added this code. I am using a chargen server as a test program and I have run this overnight from multiple sources with no problems until today. Unfortunately, I did just find a statistics problem which I am looking into. I will issue a patch if the problem is in the protection code.

David.


Dan Lewis wrote:

Dear lwIP people,

What's the recommended way to feed incoming packets up to lwIP in an 
interrupt-driven multi-threaded implmentation?

The interrupt service routine in my current implementation merely signals the 
arrival of a packet by posting to a uC/OS mailbox. I created a separate thread 
that contains an infinite loop that pends on that mailbox, and then calls 
ethernetif_input to read the packet from the NIC (using low_level_input) and pass 
it on to lwIP (using netif->input, which is a call to tcpip_input).

So the real question is this: Is it safe to initiate the call to tcpip_input 
from an independent thread in a preemptive multi-threaded system? I.e., does 
tcpip_input use kernel calls to pass the packet on to lwIP (which is running in 
a different thread)?  Or do I need to worry about critical sections in this 
scenario?

Note that in addition to tcpip_input, ethernetif_input also calls arp_ip_input, 
arp_arp_input, pbuf_header, and pbuf_free. Are these routines also thread-safe?

Is there a better way to feed incoming packets to lwIP in this kind of 
environment?

Thanks in advance!

Dan Lewis, Chair
Computer Engineering
Santa Clara University




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








reply via email to

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