lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] question on data consistence in the etharp.c module


From: John Taylor
Subject: [lwip-users] question on data consistence in the etharp.c module
Date: Tue, 27 Jan 2004 01:48:56 -0500

I have questions about threading and making calls to the etharp.c
module.  I have been researching of the code (0.7.0) to port LWIP to a
new platform.  I am using the unix/tapif code as my example for my
sys_arch code, starting LWIP, and for implementing my own netif
interface. Below is run sequence for the simhost.c unix application.

THREAD-CONTEXT: Raw Linux/Unix application thread
1) Launch unix application - runs main() in simhost.c.
2) In main(): initialize the infrastructure for LWIP (stats, sys, mem,
etc).
3) In main(): create and run Thread-Main.
4) In main(): pause forever

THREAD-CONTEXT: Thread-Main
5) Run entry-funciton, main_thread(), for Thread-Main
6) In main_thread(): Finish initializing LWIP (netif, tpcip, ppp, etc).
Note: the call to tcpip_init() spawns another thread, Thread-LWIP, which
is where the LWIP stack 'lives'.
7) In main_thread(): Add a network interface - call netif_add()
8) In netif_add(): Initialize network interface - call tapif_init()
9) In tapif_init(): Initialize low-level device - call low_level_init()
10) In low_level_init(): Initialize/Setup the TAPDEV interface.
11) In low_level_init(): Create an run Thread-Tapif
12) return from low_level_init()
13) In tapif_init(): Initialize the etharp module - call etharp_init()
14) In tapif_init(): Register a timer for period ARP_TMR_INTERVAL - the
callback is arp_timer.
13) return from tapif_init()
14) return from netif_add()
15) In main_thread(): initialize network application (httpd, shell,
tcpecho, etc.)
16) In main_thread(): wait forever on a semaphore.  This has the effect
of processing the ARP_TMR_INTERVAL.  When the time period has expired,
arp_timer() is called, which then calls etharp_tmr(), then it
re-registers the timer for ARP_TMR_INTERVAL.

THREAD-CONTEXT: Thread-Tapif
17) In tapif_thread: Block on select() until there is packet available.
Then call tapif_input()
18) In tapif_input(): Get and processing incoming packet to determine
type.  Dependeing on type, call either etharp_ip_input() or
etharp_arp_input(). 
19) loop back to the blocking select().

According to the above sequence: 
-- etharp_init() and etharp_tmr() are called from Thread-Main.
-- etharp_ip_input() and etharp_arp_input() are called from Thread-Tapif
-- etharp_output() is called from Thread-LWIP. 


Questions:
1) Is the above sequence correct or I am miss reading the code?
2) Upon examining the etharp.c module, I do not see any mutual exclusion
locking occurring.  Is this correct?
3) If there is multi-thread access to the arp table, is this or bug or I
am overlooking something?
4) LWIP supports multiple network interfaces. But does it support
multiple Ethernet network interfaces? 

TIA
-john


John T. Taylor
Shift-Right Technologies, LLC.
433 Comanche Trl
Lawrenceville, GA 30044
Tel: 678-344-3115
Fax: 770-736-9276
email: address@hidden
url: www.shift-right.com






reply via email to

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