* [Enter new changes just after this line - do not remove this line]
++ New features:
+
+ 2007-08-22 Frédéric Bernon
+ * tcpip.h, tcpip.c, ethernetif.c, opt.h: remove options ETHARP_TCPIP_INPUT &
+ ETHARP_TCPIP_ETHINPUT, now, only "ethinput" code is supported, even if the
+ name is tcpip_input (we keep the name of 1.2.0 function).
+
2007-08-17 Jared Grubb
* memp_std.h, memp.h, memp.c, mem.c, stats.c: (Task #7136) Centralize mempool
settings into new memp_std.h and optional user file lwippools.h. This adds
}
#endif /* LWIP_IGMP */
-#if ETHARP_TCPIP_ETHINPUT
+#if LWIP_ARP
/**
* Process received ethernet frames. Using this function instead of directly
* calling ip_input and passing ARP frames through etharp in ethernetif_input,
#if ETHARP_TRUST_IP_MAC
/* update ARP table */
etharp_ip_input( netif, p);
-#endif
+#endif /* ETHARP_TRUST_IP_MAC */
/* skip Ethernet header */
if(pbuf_header(p, -(s16_t)sizeof(struct eth_hdr))) {
LWIP_ASSERT("Can't move over header in packet", 0);
pbuf_free(p);
p = NULL;
- }
- else
+ } else {
/* pass to IP layer */
ip_input(p, netif);
+ }
break;
case ETHTYPE_ARP:
- /* pass p to ARP module */
+ /* pass p to ARP module */
etharp_arp_input(netif, (struct eth_addr*)(netif->hwaddr), p);
break;
case ETHTYPE_PPPOEDISC: /* PPP Over Ethernet Discovery Stage */
pppoe_disc_input(netif, p);
break;
+
case ETHTYPE_PPPOE: /* PPP Over Ethernet Session Stage */
pppoe_data_input(netif, p);
break;
return ERR_OK; /* return value ignored */
}
-#endif /* ETHARP_TCPIP_ETHINPUT */
+#endif /* LWIP_ARP */
/**
* The main lwIP thread. This thread has exclusive access to lwIP core functions
msg->msg.apimsg->function(&(msg->msg.apimsg->msg));
break;
-#if ETHARP_TCPIP_INPUT || ETHARP_TCPIP_ETHINPUT
+#if LWIP_ARP
case TCPIP_MSG_INPKT:
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: PACKET %p\n", (void *)msg));
- msg->msg.inp.f(msg->msg.inp.p, msg->msg.inp.netif);
+ ethernet_input(msg->msg.inp.p, msg->msg.inp.netif);
memp_free(MEMP_TCPIP_MSG_INPKT, msg);
break;
-#endif /* ETHARP_TCPIP_INPUT || ETHARP_TCPIP_ETHINPUT */
+#endif /* LWIP_ARP */
#if LWIP_NETIF_API
case TCPIP_MSG_NETIFAPI:
msg->msg.cb.f(msg->msg.cb.ctx);
memp_free(MEMP_TCPIP_MSG_API, msg);
break;
+
case TCPIP_MSG_TIMEOUT:
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: TIMEOUT %p\n", (void *)msg));
sys_untimeout (msg->msg.tmo.h, msg->msg.tmo.arg);
memp_free(MEMP_TCPIP_MSG_API, msg);
break;
+
default:
break;
}
}
}
-#if ETHARP_TCPIP_INPUT
+#if LWIP_ARP
/**
- * Pass a received IP packet to tcpip_thread for input processing
+ * Pass a received packet to tcpip_thread for input processing
*
- * @param p the recevied packet, p->payload pointing to the IP header
+ * @param p the received packet, p->payload pointing to the Ethernet header
* @param netif the network interface on which the packet was received
*/
err_t
}
msg->type = TCPIP_MSG_INPKT;
- msg->msg.inp.f = ip_input;
msg->msg.inp.p = p;
msg->msg.inp.netif = inp;
sys_mbox_post(mbox, msg);
}
return ERR_VAL;
}
-
-err_t
-tcpip_input_callback(struct pbuf *p, struct netif *inp, err_t (*f)(struct pbuf *, struct netif *))
-{
- struct tcpip_msg *msg;
-
- if (mbox != SYS_MBOX_NULL) {
- msg = memp_malloc(MEMP_TCPIP_MSG_INPKT);
- if (msg == NULL) {
- return ERR_MEM;
- }
-
- msg->type = TCPIP_MSG_INPKT;
- msg->msg.inp.f = f;
- msg->msg.inp.p = p;
- msg->msg.inp.netif = inp;
- sys_mbox_post(mbox, msg);
- return ERR_OK;
- }
- return ERR_VAL;
-}
-#endif /* ETHARP_TCPIP_INPUT */
-
-#if ETHARP_TCPIP_ETHINPUT
-/**
- * Pass a received IP packet to tcpip_thread for input processing
- *
- * @param p the recevied packet, p->payload pointing to the ethernet header
- * @param netif the network interface on which the packet was received
- */
-err_t
-tcpip_ethinput(struct pbuf *p, struct netif *inp)
-{
- return tcpip_input_callback(p, inp, ethernet_input);
-}
-#endif /* ETHARP_TCPIP_ETHINPUT */
+#endif /* LWIP_ARP */
/**
* Call a specific function in the thread context of
#define ETHARP_TRUST_IP_MAC 1
#endif
-/**
- * ETHARP_TCPIP_INPUT==1: Driver can pass packets to tcpip_input after it
- * has processed any incoming ARP packets. Incoming IP packets are then
- * processed in tcpip_thread context. It is recommended that you use
- * ETHARP_TCPIP_ETHINPUT instead; see that option for explanation.
- * (only useful if you use tcpip.c)
- */
-#ifndef ETHARP_TCPIP_INPUT
-#define ETHARP_TCPIP_INPUT 1
-#endif
-
-/**
- * ETHARP_TCPIP_ETHINPUT==1: Driver passes *all* packets to tcpip_ethinput
- * (and not tcpip_input). IP and ARP packets will be both processed inside
- * tcpip_thread context. The aim is to protect ARP layer against concurrent
- * access. Older ports have to be updated to use tcpip_ethinput.
- */
-#ifndef ETHARP_TCPIP_ETHINPUT
-#define ETHARP_TCPIP_ETHINPUT 1
-#endif
-
/**
* ETHARP_QUEUE_FIRST is deprecated
*/
err_t tcpip_apimsg_lock(struct api_msg *apimsg);
#endif /* LWIP_TCPIP_CORE_LOCKING */
-#if ETHARP_TCPIP_INPUT
+#if LWIP_ARP
err_t tcpip_input(struct pbuf *p, struct netif *inp);
-err_t tcpip_input_callback(struct pbuf *p, struct netif *inp, err_t (*f)(struct pbuf *, struct netif *));
-#endif /* ETHARP_TCPIP_INPUT */
-
-#if ETHARP_TCPIP_ETHINPUT
-err_t tcpip_ethinput(struct pbuf *p, struct netif *inp);
-#endif /* ETHARP_TCPIP_ETHINPUT */
+#endif /* LWIP_ARP */
#if LWIP_NETIF_API
err_t tcpip_netifapi(struct netifapi_msg *netifapimsg);
enum tcpip_msg_type {
TCPIP_MSG_API,
-#if ETHARP_TCPIP_INPUT || ETHARP_TCPIP_ETHINPUT
+#if LWIP_ARP
TCPIP_MSG_INPKT,
-#endif /* ETHARP_TCPIP_INPUT || ETHARP_TCPIP_ETHINPUT */
+#endif /* LWIP_ARP */
#if LWIP_NETIF_API
TCPIP_MSG_NETIFAPI,
#endif /* LWIP_NETIF_API */
#if LWIP_NETIF_API
struct netifapi_msg *netifapimsg;
#endif /* LWIP_NETIF_API */
+#if LWIP_ARP
struct {
struct pbuf *p;
struct netif *netif;
- err_t (*f)(struct pbuf *, struct netif *);
} inp;
+#endif /* LWIP_ARP */
struct {
void (*f)(void *ctx);
void *ctx;
switch (htons(ethhdr->type)) {
-#if ETHARP_TCPIP_ETHINPUT
/* IP or ARP packet? */
case ETHTYPE_IP:
case ETHTYPE_ARP:
+#if PPPOE_SUPPORT
+ case ETHTYPE_PPPOEDISC:
+ case ETHTYPE_PPPOE:
+#endif /* PPPOE_SUPPORT */
/* full packet send to tcpip_thread to process */
if (netif->input(p, netif)!=ERR_OK)
{ LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: IP input error\n"));
p = NULL;
}
break;
-
-#else /* ETHARP_TCPIP_ETHINPUT */
-#if ETHARP_TCPIP_INPUT
-
- /* IP packet? */
- case ETHTYPE_IP:
-#if ETHARP_TRUST_IP_MAC
- /* update ARP table */
- /* In multithreaded environments, watch out if using etharp_ip_input()
- * in another thread than the main tcpip_thread, since the ARP table
- * is not locked from concurrent access!!!
- * Use ETHARP_TCPIP_ETHINPUT=1 instead so ARP processing is done inside
- * the thread context of tcpip_thread.
- */
- etharp_ip_input(netif, p);
-#endif /* ETHARP_TRUST_IP_MAC */
- /* skip Ethernet header */
- pbuf_header(p, -sizeof(struct eth_hdr));
- /* pass to network layer */
- if (netif->input(p, netif)!=ERR_OK)
- { LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: IP input error\n"));
- pbuf_free(p);
- p = NULL;
- }
- break;
-
- /* ARP packet? */
- case ETHTYPE_ARP:
- /* pass p to ARP module */
- /* In multithreaded environments, watch out if using etharp_ip_input()
- * in another thread than the main tcpip_thread, since the ARP table
- * is not locked from concurrent access!!!
- * Use ETHARP_TCPIP_ETHINPUT=1 instead so ARP processing is done inside
- * the thread context of tcpip_thread.
- */
- etharp_arp_input(netif, ethernetif->ethaddr, p);
- break;
-
-#endif /* ETHARP_TCPIP_INPUT */
-#endif /* ETHARP_TCPIP_ETHINPUT */
-
-#if PPPOE_SUPPORT
- case ETHTYPE_PPPOEDISC: /* PPP Over Ethernet Discovery Stage */
- pppoe_disc_input(netif, p);
- break;
- case ETHTYPE_PPPOE: /* PPP Over Ethernet Session Stage */
- pppoe_data_input(netif, p);
- break;
-#endif /* PPPOE_SUPPORT */
default:
pbuf_free(p);