So, ethernetif.c skeleton will be as attached (for bug 
https://savannah.nongnu.org/bugs/?19177 ).

General initialization sequence will be :

#if LWIP_STATS
stats_init ();
#endif /* STATS */
#if (NO_SYS == 0)
sys_init ();
#endif /* (NO_SYS == 0) */
mem_init ();
memp_init ();
pbuf_init ();
etharp_init ();
netif_init ();
lwip_socket_init();

//...
netif_add( ...);
//... 

In tcpip.c, changes would be :

+static void
+arp_timer(void *arg)
+{
+  etharp_tmr();
+  sys_timeout(ARP_TMR_INTERVAL, arp_timer, NULL);
+}

And :

static void
tcpip_thread(void *arg)
{
  struct tcpip_msg *msg;
  
#if IP_REASSEMBLY
  sys_timeout( 1000, ip_timer, NULL);
#endif
  sys_timeout(ARP_TMR_INTERVAL, arp_timer, NULL);

  if (tcpip_init_done != NULL) {
    tcpip_init_done(tcpip_init_done_arg);
  }
  
  while (1) {                          /* MAIN Loop */    
    sys_mbox_fetch(mbox, (void *)&msg);
    switch (msg->type) {
    case TCPIP_MSG_API:
      LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API message %p\n", (void *)msg));
      api_msg_input(msg->msg.apimsg);
      break;
    case TCPIP_MSG_INPUT:
      LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: IP packet %p\n", (void *)msg));
      ip_input(msg->msg.inp.p, msg->msg.inp.netif);
      break;
    case TCPIP_MSG_CALLBACK:
      LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK %p\n", (void *)msg));
      msg->msg.cb.f(msg->msg.cb.ctx);
      break;
    default:
      break;
    }
    memp_free(MEMP_TCPIP_MSG, msg);
  }
}

I think the callback can be left, to be sure that stack is really ready (core 
structs initialized, timers initialized in the "good" context)...
  
====================================
Frédéric BERNON 
HYMATOM SA 
Chef de projet informatique 
Microsoft Certified Professional 
Tél. : +33 (0)4-67-87-61-10 
Fax. : +33 (0)4-67-70-85-44 
Email : [EMAIL PROTECTED] 
Web Site : http://www.hymatom.fr 
====================================
P Avant d'imprimer, penser à l'environnement
 


-----Message d'origine-----
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Frédéric BERNON
Envoyé : lundi 5 mars 2007 11:46
À : Mailing list for lwIP users
Objet : RE : RE : [lwip-users] small change in tcp/ip initialization


Ok with you.

 
  
====================================
Frédéric BERNON 
HYMATOM SA 
Chef de projet informatique 
Microsoft Certified Professional 
Tél. : +33 (0)4-67-87-61-10 
Fax. : +33 (0)4-67-70-85-44 
Email : [EMAIL PROTECTED] 
Web Site : http://www.hymatom.fr 
====================================
P Avant d'imprimer, penser à l'environnement
 


-----Message d'origine-----
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Goldschmidt 
Simon Envoyé : lundi 5 mars 2007 11:44 À : Mailing list for lwIP users Objet : 
RE: RE : [lwip-users] small change in tcp/ip initialization



Hi,

> Not sure it's a so good idea, because you couldn't initialize the "ARP 
> timer" in the tcpip_thread's context (to avoid multithread access 
> problems in ARP Table - see previous item in forum), except if this 
> timer is also initialize in
> tcpip_thread() just before ip_timer...

I think it's a MUST to initialize the ARP timer in tcpip_thread(), if only to 
avoid other users from initializing it at the wrong point.

Simon


_______________________________________________
lwip-users mailing list
[email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
BEGIN:VCARD
VERSION:2.1
N:BERNON;Frédéric;;M.
FN:Frédéric BERNON
ORG:HYMATOM SA;Recherche et Développement
TITLE:Chef de projet informatique
TEL;WORK;VOICE:04-67-87-61-10
TEL;WORK;FAX:04-67-70-85-44
ADR;WORK;ENCODING=QUOTED-PRINTABLE:;23;Zone Industrielle=0D=0A175 rue de Massacan;VENDARGUES;;34740;FRANCE;
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:23=0D=0AZone Industrielle=0D=0A175 rue de Massacan=0D=0AVENDARGUES 34740=0D=
=0AFrance
URL;WORK:http://www.hymatom.fr
ROLE:Chef de projet informatique
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
REV:20020404T083210Z
END:VCARD

Attachment: ethernetif.c.patch
Description: ethernetif.c.patch

_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to