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: Jelena Frtunik
Subject: Re: [lwip-users] Help- TCP connection does not work after a some number of packets are received
Date: Fri, 14 Sep 2012 10:41:36 +0100 (BST)

Hi Simon,

Thx a lot for the fast reply. I am not sure if i understood you well so i tried this:

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);
          /* 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;

The ethernet flag is

netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_IGMP | NETIF_FLAG_LINK_UP;

Is this correct? Or should i do sth more?

One stupid question where can see the skeleton ethernetif.c.

Thx in advance for your help.

___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
 
Von: Simon Goldschmidt <address@hidden>
An: Jelena Frtunik <address@hidden>; Mailing list for lwIP users <address@hidden>
Gesendet: 11:02 Freitag, 14.September 2012
Betreff: Re: [lwip-users] Help- TCP connection does not work after a some number of packets are received


> [..]
> 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

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users


reply via email to

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