Wed 11 Nov 2009 03:17:33 PM UTC, comment #3:
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?
|