Added LWIP_SINGLE_NETIF for small targets with only one netif (see task #13515, there might be more optimizations to come with this option)

This commit is contained in:
goldsimon
2017-03-01 16:10:50 +01:00
parent f978a7ed31
commit 0d585d55d3
13 changed files with 92 additions and 89 deletions

View File

@@ -229,8 +229,10 @@ u8_t netif_alloc_client_data_id(void);
* The following fields should be filled in by the initialization
* function for the device driver: hwaddr_len, hwaddr[], mtu, flags */
struct netif {
#if !LWIP_SINGLE_NETIF
/** pointer to next in linked list */
struct netif *next;
#endif
#if LWIP_IPV4
/** IP address configuration in network byte order */
@@ -365,8 +367,13 @@ struct netif {
#define IF__NETIF_CHECKSUM_ENABLED(netif, chksumflag)
#endif /* LWIP_CHECKSUM_CTRL_PER_NETIF */
#if LWIP_SINGLE_NETIF
#define NETIF_FOREACH(netif) if (((netif) = netif_default) != NULL)
#else /* LWIP_SINGLE_NETIF */
/** The list of network interfaces. */
extern struct netif *netif_list;
#define NETIF_FOREACH(netif) for (netif = netif_list; netif != NULL; netif = netif->next)
#endif /* LWIP_SINGLE_NETIF */
/** The default network interface. */
extern struct netif *netif_default;

View File

@@ -626,7 +626,7 @@
* (but this should only occur for AutoIP).
*/
#if !defined ETHARP_TABLE_MATCH_NETIF || defined __DOXYGEN__
#define ETHARP_TABLE_MATCH_NETIF 0
#define ETHARP_TABLE_MATCH_NETIF !LWIP_SINGLE_NETIF
#endif
/**
* @}
@@ -1417,6 +1417,14 @@
* @ingroup lwip_opts
* @{
*/
/**
* LWIP_SINGLE_NETIF==1: use a single netif only. This is the common case for
* small real-life targets. Some code like routing etc. can be left out.
*/
#if !defined LWIP_SINGLE_NETIF || defined __DOXYGEN__
#define LWIP_SINGLE_NETIF 0
#endif
/**
* LWIP_NETIF_HOSTNAME==1: use DHCP_OPTION_HOSTNAME with netif's hostname
* field.
@@ -1516,7 +1524,7 @@
* netif is available, loopback traffic uses this netif.
*/
#if !defined LWIP_HAVE_LOOPIF || defined __DOXYGEN__
#define LWIP_HAVE_LOOPIF LWIP_NETIF_LOOPBACK
#define LWIP_HAVE_LOOPIF (LWIP_NETIF_LOOPBACK && !LWIP_SINGLE_NETIF)
#endif
/**
@@ -2199,7 +2207,7 @@
* setting only for single-interface configurations.
*/
#if !defined LWIP_IPV6_SCOPES || defined __DOXYGEN__
#define LWIP_IPV6_SCOPES (LWIP_IPV6)
#define LWIP_IPV6_SCOPES (LWIP_IPV6 && !LWIP_SINGLE_NETIF)
#endif
/**