lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #27996] Thread-safety of tcp_timer_needed()


From: Albert Bartel
Subject: [lwip-devel] [bug #27996] Thread-safety of tcp_timer_needed()
Date: Wed, 11 Nov 2009 15:17:33 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20 (.NET CLR 3.5.30729)

Follow-up Comment #3, bug #27996 (project lwip):

I have got an ATMEL AVR32 UC3 port for FreeRTOS. In this port the
ethernetif.c creates a thread for ethernetif_input.
The thread function is:
static void ethernetif_input(void * pvParameters)
{
  struct netif      *netif = (struct netif *)pvParameters;
  struct pbuf       *p;

  for( ;; )
  {
    do
    {
      /* move received packet into a new pbuf */
      p = low_level_input( netif );
      if( p == NULL )
      {
        /* No packet could be read.  Wait a for an interrupt to   
           tell us there is more data available. */
        vMACBWaitForInput(100);
      }
    }while( p == NULL );

    if( ERR_OK != ethernet_input( p, netif ) )
    {
      pbuf_free(p);
      p = NULL;
    }
  }
}

In this port, if a SYN arrives, ethernet_input(struct pbuf *p, struct netif
*netif) is called.
Then ip_input(struct pbuf *p, struct netif *inp) is called,
then tcp_input(struct pbuf *p, struct netif *inp),
then tcp_listen_input(struct tcp_pcb_listen *pcb)
and there TCP_REG((pcbs, npcb)) is called,
that calls tcp_timer_needed().
So the timeout will be set only for this thread.
When I set a breakpoint in the tcpip_tcp_timer-function, I never get there,
because the tcpip thread does not handle the timeout, because it is in the
wrong thread.
After changing sys_timeout() to tcpip_timeout() I pass the breakpoint if a
timeout occurrs.

You say, that if it is called from a different thread that's the bug. So is
it wrong to call ethernet_input() from the separate ethernetif thread?

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?27996>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.nongnu.org/





reply via email to

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