Added option LWIP_NETIF_HWADDRHINT (default=off) to cache ARP table indices with each pcb instead of single-entry cache for the complete stack.

This commit is contained in:
goldsimon
2007-07-02 20:41:22 +00:00
parent fa4b711495
commit 96e4ec4a15
12 changed files with 146 additions and 7 deletions

View File

@@ -83,7 +83,9 @@ err_t ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
/* Type Of Service */ \
u8_t tos; \
/* Time To Live */ \
u8_t ttl
u8_t ttl; \
/* link layer address resolution hint */ \
u8_t addr_hint
/*
* Option flags per-socket. These are the same like SO_XXX.

View File

@@ -69,7 +69,9 @@ extern "C" {
/* Type Of Service */ \
u8_t tos; \
/* Time To Live */ \
u8_t ttl
u8_t ttl; \
/* link layer address resolution hint */ \
u8_t addr_hint
/* The IPv6 header. */

View File

@@ -155,6 +155,9 @@ struct netif {
/* This function could be called to add or delete a entry in the multicast filter table of the ethernet MAC.*/
err_t (*igmp_mac_filter)( struct netif *netif, struct ip_addr *group, u8_t action);
#endif /* LWIP_IGMP */
#if LWIP_NETIF_HWADDRHINT
u8_t *addr_hint;
#endif /* LWIP_NETIF_HWADDRHINT */
};
#if LWIP_SNMP

View File

@@ -481,6 +481,15 @@
#define LWIP_NETIF_CALLBACK 0
#endif
/** Cache link-layer-address hints (e.g. table indices) in struct netif.
TCP and UDP can make use of this to prevent scanning the ARP table
for every sent packet. While this is faster for big ARP tables or many
concurrent connections, it might be contra-productive if having a tiny
ARP table only or there never are concurrent connections. */
#ifndef LWIP_NETIF_HWADDRHINT
#define LWIP_NETIF_HWADDRHINT 0
#endif
/* Support loop interface (127.0.0.1) */
#ifndef LWIP_HAVE_LOOPIF
#define LWIP_HAVE_LOOPIF 0

View File

@@ -157,6 +157,11 @@ err_t etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr,
#define eth_addr_cmp(addr1, addr2) (memcmp((addr1)->addr, (addr2)->addr, ETHARP_HWADDR_LEN) == 0)
/* finally, check some defines */
#if ARP_TABLE_SIZE > 0x7f
#error ARP_TABLE_SIZE must fit in an s8_t
#endif
#ifdef __cplusplus
}
#endif