Clean up LWIP_NETIF_HWADDRHINT a bit: create a struct holding the hint(s) and pass a pointer to that struct around. That way we are free to add more hints if required (e.g. see task #11620)

This commit is contained in:
goldsimon 2017-04-27 12:38:53 +02:00
parent 7617a76b19
commit 6aac9377ee
12 changed files with 74 additions and 63 deletions

View File

@ -118,10 +118,10 @@ static u8_t etharp_cached_entry;
#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */ #endif /* ETHARP_SUPPORT_STATIC_ENTRIES */
#if LWIP_NETIF_HWADDRHINT #if LWIP_NETIF_HWADDRHINT
#define ETHARP_SET_HINT(netif, hint) if (((netif) != NULL) && ((netif)->addr_hint != NULL)) \ #define ETHARP_SET_ADDRHINT(netif, addrhint) do { if (((netif) != NULL) && ((netif)->hints != NULL)) { \
*((netif)->addr_hint) = (hint); (netif)->hints->addr_hint = (addrhint); }} while(0)
#else /* LWIP_NETIF_HWADDRHINT */ #else /* LWIP_NETIF_HWADDRHINT */
#define ETHARP_SET_HINT(netif, hint) (etharp_cached_entry = (hint)) #define ETHARP_SET_ADDRHINT(netif, addrhint) (etharp_cached_entry = (addrhint))
#endif /* LWIP_NETIF_HWADDRHINT */ #endif /* LWIP_NETIF_HWADDRHINT */
@ -850,9 +850,9 @@ etharp_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr)
} }
} }
#if LWIP_NETIF_HWADDRHINT #if LWIP_NETIF_HWADDRHINT
if (netif->addr_hint != NULL) { if (netif->hints != NULL) {
/* per-pcb cached entry was given */ /* per-pcb cached entry was given */
u8_t etharp_cached_entry = *(netif->addr_hint); u8_t etharp_cached_entry = netif->hints->addr_hint;
if (etharp_cached_entry < ARP_TABLE_SIZE) { if (etharp_cached_entry < ARP_TABLE_SIZE) {
#endif /* LWIP_NETIF_HWADDRHINT */ #endif /* LWIP_NETIF_HWADDRHINT */
if ((arp_table[etharp_cached_entry].state >= ETHARP_STATE_STABLE) && if ((arp_table[etharp_cached_entry].state >= ETHARP_STATE_STABLE) &&
@ -878,7 +878,7 @@ etharp_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr)
#endif #endif
(ip4_addr_cmp(dst_addr, &arp_table[i].ipaddr))) { (ip4_addr_cmp(dst_addr, &arp_table[i].ipaddr))) {
/* found an existing, stable entry */ /* found an existing, stable entry */
ETHARP_SET_HINT(netif, i); ETHARP_SET_ADDRHINT(netif, i);
return etharp_output_to_arp_index(netif, q, i); return etharp_output_to_arp_index(netif, q, i);
} }
} }
@ -988,7 +988,7 @@ etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q)
/* stable entry? */ /* stable entry? */
if (arp_table[i].state >= ETHARP_STATE_STABLE) { if (arp_table[i].state >= ETHARP_STATE_STABLE) {
/* we have a valid IP->Ethernet address mapping */ /* we have a valid IP->Ethernet address mapping */
ETHARP_SET_HINT(netif, i); ETHARP_SET_ADDRHINT(netif, i);
/* send the packet */ /* send the packet */
result = ethernet_output(netif, q, srcaddr, &(arp_table[i].ethaddr), ETHTYPE_IP); result = ethernet_output(netif, q, srcaddr, &(arp_table[i].ethaddr), ETHTYPE_IP);
/* pending entry? (either just created or already pending */ /* pending entry? (either just created or already pending */

View File

@ -1006,7 +1006,7 @@ ip4_output(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
return ip4_output_if(p, src, dest, ttl, tos, proto, netif); return ip4_output_if(p, src, dest, ttl, tos, proto, netif);
} }
#if LWIP_NETIF_HWADDRHINT #if LWIP_NETIF_USE_HINTS
/** Like ip_output, but takes and addr_hint pointer that is passed on to netif->addr_hint /** Like ip_output, but takes and addr_hint pointer that is passed on to netif->addr_hint
* before calling ip_output_if. * before calling ip_output_if.
* *
@ -1019,7 +1019,7 @@ ip4_output(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
* @param ttl the TTL value to be set in the IP header * @param ttl the TTL value to be set in the IP header
* @param tos the TOS value to be set in the IP header * @param tos the TOS value to be set in the IP header
* @param proto the PROTOCOL to be set in the IP header * @param proto the PROTOCOL to be set in the IP header
* @param addr_hint address hint pointer set to netif->addr_hint before * @param netif_hint netif output hint pointer set to netif->hint before
* calling ip_output_if() * calling ip_output_if()
* *
* @return ERR_RTE if no route is found * @return ERR_RTE if no route is found
@ -1027,7 +1027,7 @@ ip4_output(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
*/ */
err_t err_t
ip4_output_hinted(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest, ip4_output_hinted(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
u8_t ttl, u8_t tos, u8_t proto, u8_t *addr_hint) u8_t ttl, u8_t tos, u8_t proto, struct netif_hint *netif_hint)
{ {
struct netif *netif; struct netif *netif;
err_t err; err_t err;
@ -1041,13 +1041,13 @@ ip4_output_hinted(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
return ERR_RTE; return ERR_RTE;
} }
NETIF_SET_HWADDRHINT(netif, addr_hint); NETIF_SET_HINTS(netif, netif_hint);
err = ip4_output_if(p, src, dest, ttl, tos, proto, netif); err = ip4_output_if(p, src, dest, ttl, tos, proto, netif);
NETIF_SET_HWADDRHINT(netif, NULL); NETIF_RESET_HINTS(netif);
return err; return err;
} }
#endif /* LWIP_NETIF_HWADDRHINT*/ #endif /* LWIP_NETIF_USE_HINTS*/
#if IP_DEBUG #if IP_DEBUG
/* Print an IP header by using LWIP_DEBUGF /* Print an IP header by using LWIP_DEBUGF

View File

@ -1114,7 +1114,7 @@ ip6_output(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
} }
#if LWIP_NETIF_HWADDRHINT #if LWIP_NETIF_USE_HINTS
/** Like ip6_output, but takes and addr_hint pointer that is passed on to netif->addr_hint /** Like ip6_output, but takes and addr_hint pointer that is passed on to netif->addr_hint
* before calling ip6_output_if. * before calling ip6_output_if.
* *
@ -1128,7 +1128,7 @@ ip6_output(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
* @param hl the Hop Limit value to be set in the IPv6 header * @param hl the Hop Limit value to be set in the IPv6 header
* @param tc the Traffic Class value to be set in the IPv6 header * @param tc the Traffic Class value to be set in the IPv6 header
* @param nexth the Next Header to be set in the IPv6 header * @param nexth the Next Header to be set in the IPv6 header
* @param addr_hint address hint pointer set to netif->addr_hint before * @param netif_hint netif output hint pointer set to netif->hint before
* calling ip_output_if() * calling ip_output_if()
* *
* @return ERR_RTE if no route is found * @return ERR_RTE if no route is found
@ -1136,7 +1136,7 @@ ip6_output(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
*/ */
err_t err_t
ip6_output_hinted(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest, ip6_output_hinted(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
u8_t hl, u8_t tc, u8_t nexth, u8_t *addr_hint) u8_t hl, u8_t tc, u8_t nexth, struct netif_hint *netif_hint)
{ {
struct netif *netif; struct netif *netif;
struct ip6_hdr *ip6hdr; struct ip6_hdr *ip6hdr;
@ -1169,13 +1169,13 @@ ip6_output_hinted(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
return ERR_RTE; return ERR_RTE;
} }
NETIF_SET_HWADDRHINT(netif, addr_hint); NETIF_SET_HINTS(netif, netif_hint);
err = ip6_output_if(p, src, dest, hl, tc, nexth, netif); err = ip6_output_if(p, src, dest, hl, tc, nexth, netif);
NETIF_SET_HWADDRHINT(netif, NULL); NETIF_RESET_HINTS(netif);
return err; return err;
} }
#endif /* LWIP_NETIF_HWADDRHINT*/ #endif /* LWIP_NETIF_USE_HINTS*/
#if LWIP_IPV6_MLD #if LWIP_IPV6_MLD
/** /**

View File

@ -1907,9 +1907,9 @@ nd6_get_next_hop_entry(const ip6_addr_t *ip6addr, struct netif *netif)
IP6_ADDR_ZONECHECK_NETIF(ip6addr, netif); IP6_ADDR_ZONECHECK_NETIF(ip6addr, netif);
#if LWIP_NETIF_HWADDRHINT #if LWIP_NETIF_HWADDRHINT
if (netif->addr_hint != NULL) { if (netif->hints != NULL) {
/* per-pcb cached entry was given */ /* per-pcb cached entry was given */
u8_t addr_hint = *(netif->addr_hint); u8_t addr_hint = netif->hints->addr_hint;
if (addr_hint < LWIP_ND6_NUM_DESTINATIONS) { if (addr_hint < LWIP_ND6_NUM_DESTINATIONS) {
nd6_cached_destination_index = addr_hint; nd6_cached_destination_index = addr_hint;
} }
@ -1968,9 +1968,9 @@ nd6_get_next_hop_entry(const ip6_addr_t *ip6addr, struct netif *netif)
} }
#if LWIP_NETIF_HWADDRHINT #if LWIP_NETIF_HWADDRHINT
if (netif->addr_hint != NULL) { if (netif->hints != NULL) {
/* per-pcb cached entry was given */ /* per-pcb cached entry was given */
*(netif->addr_hint) = nd6_cached_destination_index; netif->hints->addr_hint = nd6_cached_destination_index;
} }
#endif /* LWIP_NETIF_HWADDRHINT */ #endif /* LWIP_NETIF_HWADDRHINT */

View File

@ -332,7 +332,7 @@ netif_add(struct netif *netif,
netif->num = netif_num; netif->num = netif_num;
netif->input = input; netif->input = input;
NETIF_SET_HWADDRHINT(netif, NULL); NETIF_RESET_HINTS(netif);
#if ENABLE_LOOPBACK && LWIP_LOOPBACK_MAX_PBUFS #if ENABLE_LOOPBACK && LWIP_LOOPBACK_MAX_PBUFS
netif->loop_cnt_current = 0; netif->loop_cnt_current = 0;
#endif /* ENABLE_LOOPBACK && LWIP_LOOPBACK_MAX_PBUFS */ #endif /* ENABLE_LOOPBACK && LWIP_LOOPBACK_MAX_PBUFS */

View File

@ -412,9 +412,9 @@ raw_sendto_if_src(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
return ERR_VAL; return ERR_VAL;
} }
/* @todo multicast loop support, if at all desired for this scenario.. */ /* @todo multicast loop support, if at all desired for this scenario.. */
NETIF_SET_HWADDRHINT(netif, &pcb->addr_hint); NETIF_SET_HINTS(netif, &pcb->netif_hints);
err = ip_output_if_hdrincl(p, src_ip, dst_ip, netif); err = ip_output_if_hdrincl(p, src_ip, dst_ip, netif);
NETIF_SET_HWADDRHINT(netif, NULL); NETIF_RESET_HINTS(netif);
return err; return err;
} }
@ -485,9 +485,9 @@ raw_sendto_if_src(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
ttl = pcb->ttl; ttl = pcb->ttl;
#endif /* LWIP_MULTICAST_TX_OPTIONS */ #endif /* LWIP_MULTICAST_TX_OPTIONS */
NETIF_SET_HWADDRHINT(netif, &pcb->addr_hint); NETIF_SET_HINTS(netif, &pcb->netif_hints);
err = ip_output_if(q, src_ip, dst_ip, ttl, pcb->tos, pcb->protocol, netif); err = ip_output_if(q, src_ip, dst_ip, ttl, pcb->tos, pcb->protocol, netif);
NETIF_SET_HWADDRHINT(netif, NULL); NETIF_RESET_HINTS(netif);
/* did we chain a header earlier? */ /* did we chain a header earlier? */
if (q != p) { if (q != p) {

View File

@ -969,10 +969,10 @@ tcp_send_empty_ack(struct tcp_pcb *pcb)
&pcb->local_ip, &pcb->remote_ip); &pcb->local_ip, &pcb->remote_ip);
} }
#endif #endif
NETIF_SET_HWADDRHINT(netif, &(pcb->addr_hint)); NETIF_SET_HINTS(netif, &(pcb->netif_hints));
err = ip_output_if(p, &pcb->local_ip, &pcb->remote_ip, err = ip_output_if(p, &pcb->local_ip, &pcb->remote_ip,
pcb->ttl, pcb->tos, IP_PROTO_TCP, netif); pcb->ttl, pcb->tos, IP_PROTO_TCP, netif);
NETIF_SET_HWADDRHINT(netif, NULL); NETIF_RESET_HINTS(netif);
} }
pbuf_free(p); pbuf_free(p);
@ -1319,10 +1319,10 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
#endif /* CHECKSUM_GEN_TCP */ #endif /* CHECKSUM_GEN_TCP */
TCP_STATS_INC(tcp.xmit); TCP_STATS_INC(tcp.xmit);
NETIF_SET_HWADDRHINT(netif, &(pcb->addr_hint)); NETIF_SET_HINTS(netif, &(pcb->netif_hints));
err = ip_output_if(seg->p, &pcb->local_ip, &pcb->remote_ip, pcb->ttl, err = ip_output_if(seg->p, &pcb->local_ip, &pcb->remote_ip, pcb->ttl,
pcb->tos, IP_PROTO_TCP, netif); pcb->tos, IP_PROTO_TCP, netif);
NETIF_SET_HWADDRHINT(netif, NULL); NETIF_RESET_HINTS(netif);
return err; return err;
} }
@ -1573,9 +1573,9 @@ tcp_keepalive(struct tcp_pcb *pcb)
TCP_STATS_INC(tcp.xmit); TCP_STATS_INC(tcp.xmit);
/* Send output to IP */ /* Send output to IP */
NETIF_SET_HWADDRHINT(netif, &(pcb->addr_hint)); NETIF_SET_HINTS(netif, &(pcb->netif_hints));
err = ip_output_if(p, &pcb->local_ip, &pcb->remote_ip, pcb->ttl, 0, IP_PROTO_TCP, netif); err = ip_output_if(p, &pcb->local_ip, &pcb->remote_ip, pcb->ttl, 0, IP_PROTO_TCP, netif);
NETIF_SET_HWADDRHINT(netif, NULL); NETIF_RESET_HINTS(netif);
} }
pbuf_free(p); pbuf_free(p);
@ -1666,10 +1666,10 @@ tcp_zero_window_probe(struct tcp_pcb *pcb)
TCP_STATS_INC(tcp.xmit); TCP_STATS_INC(tcp.xmit);
/* Send output to IP */ /* Send output to IP */
NETIF_SET_HWADDRHINT(netif, &(pcb->addr_hint)); NETIF_SET_HINTS(netif, &(pcb->netif_hints));
err = ip_output_if(p, &pcb->local_ip, &pcb->remote_ip, pcb->ttl, err = ip_output_if(p, &pcb->local_ip, &pcb->remote_ip, pcb->ttl,
0, IP_PROTO_TCP, netif); 0, IP_PROTO_TCP, netif);
NETIF_SET_HWADDRHINT(netif, NULL); NETIF_RESET_HINTS(netif);
} }
pbuf_free(p); pbuf_free(p);

View File

@ -859,9 +859,9 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d
LWIP_DEBUGF(UDP_DEBUG, ("udp_send: UDP checksum 0x%04"X16_F"\n", udphdr->chksum)); LWIP_DEBUGF(UDP_DEBUG, ("udp_send: UDP checksum 0x%04"X16_F"\n", udphdr->chksum));
LWIP_DEBUGF(UDP_DEBUG, ("udp_send: ip_output_if (,,,,0x%02"X16_F",)\n", (u16_t)ip_proto)); LWIP_DEBUGF(UDP_DEBUG, ("udp_send: ip_output_if (,,,,0x%02"X16_F",)\n", (u16_t)ip_proto));
/* output to IP */ /* output to IP */
NETIF_SET_HWADDRHINT(netif, &(pcb->addr_hint)); NETIF_SET_HINTS(netif, &(pcb->netif_hints));
err = ip_output_if_src(q, src_ip, dst_ip, ttl, pcb->tos, ip_proto, netif); err = ip_output_if_src(q, src_ip, dst_ip, ttl, pcb->tos, ip_proto, netif);
NETIF_SET_HWADDRHINT(netif, NULL); NETIF_RESET_HINTS(netif);
/* @todo: must this be increased even if error occurred? */ /* @todo: must this be increased even if error occurred? */
MIB2_STATS_INC(mib2.udpoutdatagrams); MIB2_STATS_INC(mib2.udpoutdatagrams);

View File

@ -63,11 +63,11 @@ extern "C" {
#define LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX(p) LWIP_ASSERT("p->ref == 1", (p)->ref == 1) #define LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX(p) LWIP_ASSERT("p->ref == 1", (p)->ref == 1)
#endif #endif
#if LWIP_NETIF_HWADDRHINT #if LWIP_NETIF_USE_HINTS
#define IP_PCB_ADDRHINT ;u8_t addr_hint #define IP_PCB_NETIFHINT ;struct netif_hint netif_hints
#else #else /* LWIP_NETIF_USE_HINTS */
#define IP_PCB_ADDRHINT #define IP_PCB_NETIFHINT
#endif /* LWIP_NETIF_HWADDRHINT */ #endif /* LWIP_NETIF_USE_HINTS */
/** This is the common part of all PCB types. It needs to be at the /** This is the common part of all PCB types. It needs to be at the
beginning of a PCB type definition. It is located here so that beginning of a PCB type definition. It is located here so that
@ -84,7 +84,7 @@ extern "C" {
/* Time To Live */ \ /* Time To Live */ \
u8_t ttl \ u8_t ttl \
/* link layer address resolution hint */ \ /* link layer address resolution hint */ \
IP_PCB_ADDRHINT IP_PCB_NETIFHINT
struct ip_pcb { struct ip_pcb {
/* Common members of all PCB types */ /* Common members of all PCB types */
@ -248,11 +248,11 @@ extern struct ip_globals ip_data;
(IP_IS_V6(dest) ? \ (IP_IS_V6(dest) ? \
ip6_output_if(p, ip_2_ip6(src), LWIP_IP_HDRINCL, 0, 0, 0, netif) : \ ip6_output_if(p, ip_2_ip6(src), LWIP_IP_HDRINCL, 0, 0, 0, netif) : \
ip4_output_if(p, ip_2_ip4(src), LWIP_IP_HDRINCL, 0, 0, 0, netif)) ip4_output_if(p, ip_2_ip4(src), LWIP_IP_HDRINCL, 0, 0, 0, netif))
/** Output IP packet with addr_hint */ /** Output IP packet with netif_hint */
#define ip_output_hinted(p, src, dest, ttl, tos, proto, addr_hint) \ #define ip_output_hinted(p, src, dest, ttl, tos, proto, netif_hint) \
(IP_IS_V6(dest) ? \ (IP_IS_V6(dest) ? \
ip6_output_hinted(p, ip_2_ip6(src), ip_2_ip6(dest), ttl, tos, proto, addr_hint) : \ ip6_output_hinted(p, ip_2_ip6(src), ip_2_ip6(dest), ttl, tos, proto, netif_hint) : \
ip4_output_hinted(p, ip_2_ip4(src), ip_2_ip4(dest), ttl, tos, proto, addr_hint)) ip4_output_hinted(p, ip_2_ip4(src), ip_2_ip4(dest), ttl, tos, proto, v))
/** /**
* @ingroup ip * @ingroup ip
* Get netif for address combination. See \ref ip6_route and \ref ip4_route * Get netif for address combination. See \ref ip6_route and \ref ip4_route
@ -280,8 +280,8 @@ err_t ip_input(struct pbuf *p, struct netif *inp);
ip4_output_if(p, src, dest, ttl, tos, proto, netif) ip4_output_if(p, src, dest, ttl, tos, proto, netif)
#define ip_output_if_src(p, src, dest, ttl, tos, proto, netif) \ #define ip_output_if_src(p, src, dest, ttl, tos, proto, netif) \
ip4_output_if_src(p, src, dest, ttl, tos, proto, netif) ip4_output_if_src(p, src, dest, ttl, tos, proto, netif)
#define ip_output_hinted(p, src, dest, ttl, tos, proto, addr_hint) \ #define ip_output_hinted(p, src, dest, ttl, tos, proto, netif_hint) \
ip4_output_hinted(p, src, dest, ttl, tos, proto, addr_hint) ip4_output_hinted(p, src, dest, ttl, tos, proto, netif_hint)
#define ip_output_if_hdrincl(p, src, dest, netif) \ #define ip_output_if_hdrincl(p, src, dest, netif) \
ip4_output_if(p, src, LWIP_IP_HDRINCL, 0, 0, 0, netif) ip4_output_if(p, src, LWIP_IP_HDRINCL, 0, 0, 0, netif)
#define ip_route(src, dest) \ #define ip_route(src, dest) \
@ -300,8 +300,8 @@ err_t ip_input(struct pbuf *p, struct netif *inp);
ip6_output_if(p, src, dest, ttl, tos, proto, netif) ip6_output_if(p, src, dest, ttl, tos, proto, netif)
#define ip_output_if_src(p, src, dest, ttl, tos, proto, netif) \ #define ip_output_if_src(p, src, dest, ttl, tos, proto, netif) \
ip6_output_if_src(p, src, dest, ttl, tos, proto, netif) ip6_output_if_src(p, src, dest, ttl, tos, proto, netif)
#define ip_output_hinted(p, src, dest, ttl, tos, proto, addr_hint) \ #define ip_output_hinted(p, src, dest, ttl, tos, proto, netif_hint) \
ip6_output_hinted(p, src, dest, ttl, tos, proto, addr_hint) ip6_output_hinted(p, src, dest, ttl, tos, proto, netif_hint)
#define ip_output_if_hdrincl(p, src, dest, netif) \ #define ip_output_if_hdrincl(p, src, dest, netif) \
ip6_output_if(p, src, LWIP_IP_HDRINCL, 0, 0, 0, netif) ip6_output_if(p, src, LWIP_IP_HDRINCL, 0, 0, 0, netif)
#define ip_route(src, dest) \ #define ip_route(src, dest) \

View File

@ -75,10 +75,10 @@ err_t ip4_output_if(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *des
u8_t ttl, u8_t tos, u8_t proto, struct netif *netif); u8_t ttl, u8_t tos, u8_t proto, struct netif *netif);
err_t ip4_output_if_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest, err_t ip4_output_if_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
u8_t ttl, u8_t tos, u8_t proto, struct netif *netif); u8_t ttl, u8_t tos, u8_t proto, struct netif *netif);
#if LWIP_NETIF_HWADDRHINT #if LWIP_NETIF_USE_HINTS
err_t ip4_output_hinted(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest, err_t ip4_output_hinted(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
u8_t ttl, u8_t tos, u8_t proto, u8_t *addr_hint); u8_t ttl, u8_t tos, u8_t proto, struct netif_hint *netif_hint);
#endif /* LWIP_NETIF_HWADDRHINT */ #endif /* LWIP_NETIF_USE_HINTS */
#if IP_OPTIONS_SEND #if IP_OPTIONS_SEND
err_t ip4_output_if_opt(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest, err_t ip4_output_if_opt(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options, u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options,

View File

@ -66,10 +66,10 @@ err_t ip6_output_if(struct pbuf *p, const ip6_addr_t *src, const ip6_add
u8_t hl, u8_t tc, u8_t nexth, struct netif *netif); u8_t hl, u8_t tc, u8_t nexth, struct netif *netif);
err_t ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest, err_t ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
u8_t hl, u8_t tc, u8_t nexth, struct netif *netif); u8_t hl, u8_t tc, u8_t nexth, struct netif *netif);
#if LWIP_NETIF_HWADDRHINT #if LWIP_NETIF_USE_HINTS
err_t ip6_output_hinted(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest, err_t ip6_output_hinted(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
u8_t hl, u8_t tc, u8_t nexth, u8_t *addr_hint); u8_t hl, u8_t tc, u8_t nexth, struct netif_hint *netif_hint);
#endif /* LWIP_NETIF_HWADDRHINT */ #endif /* LWIP_NETIF_USE_HINTS */
#if LWIP_IPV6_MLD #if LWIP_IPV6_MLD
err_t ip6_options_add_hbh_ra(struct pbuf * p, u8_t nexth, u8_t value); err_t ip6_options_add_hbh_ra(struct pbuf * p, u8_t nexth, u8_t value);
#endif /* LWIP_IPV6_MLD */ #endif /* LWIP_IPV6_MLD */

View File

@ -225,6 +225,15 @@ u8_t netif_alloc_client_data_id(void);
#define netif_get_client_data(netif, id) (netif)->client_data[(id)] #define netif_get_client_data(netif, id) (netif)->client_data[(id)]
#endif #endif
#if LWIP_NETIF_HWADDRHINT
#define LWIP_NETIF_USE_HINTS 1
struct netif_hint {
u8_t addr_hint;
};
#else /* LWIP_NETIF_HWADDRHINT */
#define LWIP_NETIF_USE_HINTS 0
#endif /* LWIP_NETIF_HWADDRHINT */
/** Generic data structure used for all lwIP network interfaces. /** Generic data structure used for all lwIP network interfaces.
* The following fields should be filled in by the initialization * The following fields should be filled in by the initialization
* function for the device driver: hwaddr_len, hwaddr[], mtu, flags */ * function for the device driver: hwaddr_len, hwaddr[], mtu, flags */
@ -345,9 +354,9 @@ struct netif {
filter table of the ethernet MAC. */ filter table of the ethernet MAC. */
netif_mld_mac_filter_fn mld_mac_filter; netif_mld_mac_filter_fn mld_mac_filter;
#endif /* LWIP_IPV6 && LWIP_IPV6_MLD */ #endif /* LWIP_IPV6 && LWIP_IPV6_MLD */
#if LWIP_NETIF_HWADDRHINT #if LWIP_NETIF_USE_HINTS
u8_t *addr_hint; struct netif_hint *hints;
#endif /* LWIP_NETIF_HWADDRHINT */ #endif /* LWIP_NETIF_USE_HINTS */
#if ENABLE_LOOPBACK #if ENABLE_LOOPBACK
/* List of packets to be queued for ourselves. */ /* List of packets to be queued for ourselves. */
struct pbuf *loop_first; struct pbuf *loop_first;
@ -501,9 +510,11 @@ err_t netif_add_ip6_address(struct netif *netif, const ip6_addr_t *ip6addr, s8_t
#endif /* LWIP_IPV6 */ #endif /* LWIP_IPV6 */
#if LWIP_NETIF_HWADDRHINT #if LWIP_NETIF_HWADDRHINT
#define NETIF_SET_HWADDRHINT(netif, hint) ((netif)->addr_hint = (hint)) #define NETIF_SET_HINTS(netif, netifhint) (netif)->hints = (netifhint)
#define NETIF_RESET_HINTS(netif) (netif)->hints = NULL
#else /* LWIP_NETIF_HWADDRHINT */ #else /* LWIP_NETIF_HWADDRHINT */
#define NETIF_SET_HWADDRHINT(netif, hint) #define NETIF_SET_HINTS(netif, netifhint)
#define NETIF_RESET_HINTS(netif)
#endif /* LWIP_NETIF_HWADDRHINT */ #endif /* LWIP_NETIF_HWADDRHINT */
u8_t netif_name_to_index(const char *name); u8_t netif_name_to_index(const char *name);