mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-02 12:34:38 +08:00
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).
This commit is contained in:
parent
c4b97a1710
commit
42f3c24fc4
@ -18,6 +18,12 @@ HISTORY
|
||||
* [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
|
||||
|
@ -205,7 +205,7 @@ igmp_timer(void *arg)
|
||||
}
|
||||
#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,
|
||||
@ -228,20 +228,20 @@ ethernet_input(struct pbuf *p, struct netif *netif)
|
||||
#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;
|
||||
|
||||
@ -249,6 +249,7 @@ ethernet_input(struct pbuf *p, struct netif *netif)
|
||||
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;
|
||||
@ -262,7 +263,7 @@ ethernet_input(struct pbuf *p, struct netif *netif)
|
||||
|
||||
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
|
||||
@ -312,13 +313,13 @@ tcpip_thread(void *arg)
|
||||
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:
|
||||
@ -332,6 +333,7 @@ tcpip_thread(void *arg)
|
||||
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));
|
||||
|
||||
@ -341,17 +343,18 @@ tcpip_thread(void *arg)
|
||||
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
|
||||
@ -366,7 +369,6 @@ tcpip_input(struct pbuf *p, struct netif *inp)
|
||||
}
|
||||
|
||||
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);
|
||||
@ -374,42 +376,7 @@ tcpip_input(struct pbuf *p, struct netif *inp)
|
||||
}
|
||||
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
|
||||
|
@ -316,27 +316,6 @@
|
||||
#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
|
||||
*/
|
||||
|
@ -64,14 +64,9 @@ err_t tcpip_apimsg(struct api_msg *apimsg);
|
||||
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);
|
||||
@ -86,9 +81,9 @@ err_t tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg);
|
||||
|
||||
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 */
|
||||
@ -104,11 +99,12 @@ struct tcpip_msg {
|
||||
#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;
|
||||
|
@ -236,10 +236,13 @@ ethernetif_input(struct netif *netif)
|
||||
|
||||
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"));
|
||||
@ -247,55 +250,6 @@ ethernetif_input(struct netif *netif)
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user