net/iface: Coalesce all RS timers through one

This reduces the size of struct net_if_ipv6 by 24 bytes by moving
the k_delayed_work attribute into net_if core code.
Then each net_if_ipv6 can be added to the timer handler via a slist.

This does not make much gain if the system has only 1 network interface
It starts to be interesting if it has 2+ network interfaces then.

Fixes #8728

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2019-05-21 12:07:08 +02:00 committed by Jukka Rissanen
commit b5bcd25398
3 changed files with 91 additions and 29 deletions

View file

@ -220,9 +220,6 @@ struct net_if_ipv6 {
/** Prefixes */
struct net_if_ipv6_prefix prefix[NET_IF_MAX_IPV6_PREFIX];
/** Router solicitation timer */
struct k_delayed_work rs_timer;
/** Default reachable time (RFC 4861, page 52) */
u32_t base_reachable_time;
@ -231,12 +228,19 @@ struct net_if_ipv6 {
/** Retransmit timer (RFC 4861, page 52) */
u32_t retrans_timer;
#if defined(CONFIG_NET_IPV6_ND)
/** Router solicitation timer node */
sys_snode_t rs_node;
/** IPv6 hop limit */
u8_t hop_limit;
/* RS start time */
u32_t rs_start;
/** RS count */
u8_t rs_count;
#endif
/** IPv6 hop limit */
u8_t hop_limit;
};
/** @cond INTERNAL_HIDDEN */
@ -659,6 +663,21 @@ static inline void net_if_start_dad(struct net_if *iface)
*/
void net_if_start_rs(struct net_if *iface);
/**
* @brief Stop neighbor discovery.
*
* @param iface Pointer to a network interface structure
*/
#if defined(CONFIG_NET_IPV6_ND)
void net_if_stop_rs(struct net_if *iface);
#else
static inline void net_if_stop_rs(struct net_if *iface)
{
ARG_UNUSED(iface);
}
#endif /* CONFIG_NET_IPV6_ND */
/**
* @brief Set a network interface's link address
*