mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 21:44:38 +08:00
Further improvement to netif input function autoselection: Select between netif_input() and tcpip_input() depending on NO_SYS setting
This commit is contained in:
parent
4b67c582f6
commit
0c7d015ec4
@ -176,7 +176,7 @@ netif_init(void)
|
|||||||
* Pass a received packet for input processing with
|
* Pass a received packet for input processing with
|
||||||
* ethernet_input or ip_input depending on netif flags.
|
* ethernet_input or ip_input depending on netif flags.
|
||||||
*/
|
*/
|
||||||
static err_t
|
err_t
|
||||||
netif_input(struct pbuf *p, struct netif *inp)
|
netif_input(struct pbuf *p, struct netif *inp)
|
||||||
{
|
{
|
||||||
#if LWIP_ETHERNET
|
#if LWIP_ETHERNET
|
||||||
@ -198,14 +198,17 @@ netif_input(struct pbuf *p, struct netif *inp)
|
|||||||
* @param state opaque data passed to the new netif
|
* @param state opaque data passed to the new netif
|
||||||
* @param init callback function that initializes the interface
|
* @param init callback function that initializes the interface
|
||||||
* @param input callback function that is called to pass
|
* @param input callback function that is called to pass
|
||||||
* ingress packets up in the protocol layer stack. If a NULL
|
* ingress packets up in the protocol layer stack.\n
|
||||||
* pointer is supplied, a default input function is used
|
* If a NULL pointer is supplied, a default input function is used
|
||||||
* that uses netif flags NETIF_FLAG_ETHARP and NETIF_FLAG_ETHERNET
|
* that uses netif flags NETIF_FLAG_ETHARP and NETIF_FLAG_ETHERNET
|
||||||
* to decide whether to pass to ethernet_input() or ip_input(). Since
|
* to decide whether to forward to ethernet_input() or ip_input().\n
|
||||||
* the flags are usually managed by the one implementing the ethernet
|
* Depending on NO_SYS, a function that passes the input directly to the stack
|
||||||
|
* (netif_input()) or via sending a message to TCPIP thread (tcpip_input())
|
||||||
|
* is used.\n
|
||||||
|
* Since the flags are usually managed by the one implementing the ethernet
|
||||||
* driver, the end user does not have to worry about choosing the correct
|
* driver, the end user does not have to worry about choosing the correct
|
||||||
* one here. In other words, this only works when the netif driver is
|
* input function here. In other words, this only works when the netif
|
||||||
* implemented correctly!
|
* driver is implemented correctly!
|
||||||
*
|
*
|
||||||
* @return netif, or NULL if failed.
|
* @return netif, or NULL if failed.
|
||||||
*/
|
*/
|
||||||
@ -279,7 +282,11 @@ netif_add(struct netif *netif,
|
|||||||
if(input != NULL) {
|
if(input != NULL) {
|
||||||
netif->input = input;
|
netif->input = input;
|
||||||
} else {
|
} else {
|
||||||
|
#if NO_SYS
|
||||||
netif->input = netif_input;
|
netif->input = netif_input;
|
||||||
|
#else
|
||||||
|
netif->input = tcpip_input;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
NETIF_SET_HWADDRHINT(netif, NULL);
|
NETIF_SET_HWADDRHINT(netif, NULL);
|
||||||
#if ENABLE_LOOPBACK && LWIP_LOOPBACK_MAX_PBUFS
|
#if ENABLE_LOOPBACK && LWIP_LOOPBACK_MAX_PBUFS
|
||||||
|
@ -413,6 +413,8 @@ void netif_poll_all(void);
|
|||||||
#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */
|
#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */
|
||||||
#endif /* ENABLE_LOOPBACK */
|
#endif /* ENABLE_LOOPBACK */
|
||||||
|
|
||||||
|
err_t netif_input(struct pbuf *p, struct netif *inp);
|
||||||
|
|
||||||
#if LWIP_IPV6
|
#if LWIP_IPV6
|
||||||
/** @ingroup netif */
|
/** @ingroup netif */
|
||||||
#define netif_ip_addr6(netif, i) ((const ip_addr_t*)(&((netif)->ip6_addr[i])))
|
#define netif_ip_addr6(netif, i) ((const ip_addr_t*)(&((netif)->ip6_addr[i])))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user