lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Help- TCP connection does not work after a some number


From: Simon Goldschmidt
Subject: Re: [lwip-users] Help- TCP connection does not work after a some number of packets are received
Date: Fri, 14 Sep 2012 11:02:49 +0200

Jelena Frtunik wrote:
> [..]
> static void ethernetif_input( void * pvParameters )
> {
> [..]
> switch (htons(ethhdr->type))
> {
> /* IP packet? */
> case 256:
> case ETHTYPE_IP:
>                           /* full packet send to tcpip_thread
> to process */
> if (s_pxNetIf->input(p, s_pxNetIf) != ERR_OK)
> {
> LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: IP input error\n"));
> pbuf_free(p);
> p = NULL;
> }
> break;
>       
>       case ETHTYPE_ARP:                    
>   /* pass p to ARP module  */
>         ethernet_input(p, s_pxNetIf);

This is wrong and you'll get threading problems. Instead, call 
"s_pxNetIf->input()" for ARP, too, so that ARP packets are processed in 
tcpip_thread, too, not in interrupt context. For this to work, you'll have to 
set the ethernet flag in netif->flags and make sure to pass the correct input 
function netif_add() (for NO_SYS==1, this would be 'ethernet_input', for 
NO_SYS==0, this would be 'tcpip_input'). See the skeleton ethernetif.c.

Simon



reply via email to

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