lwip-users
[Top][All Lists]
Advanced

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

RE : RE : RE : [lwip-users] small change in tcp/ip initialization


From: Frédéric BERNON
Subject: RE : RE : RE : [lwip-users] small change in tcp/ip initialization
Date: Mon, 5 Mar 2007 12:13:36 +0100

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 : address@hidden 
Web Site : http://www.hymatom.fr 
====================================
P Avant d'imprimer, penser à l'environnement
 


-----Message d'origine-----
De : address@hidden [mailto:address@hidden 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 : address@hidden 
Web Site : http://www.hymatom.fr 
====================================
P Avant d'imprimer, penser à l'environnement
 


-----Message d'origine-----
De : address@hidden [mailto:address@hidden 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
address@hidden http://lists.nongnu.org/mailman/listinfo/lwip-users

Attachment: Frédéric BERNON.vcf
Description: Frédéric BERNON.vcf

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


reply via email to

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