mirror of
https://github.com/torvalds/linux.git
synced 2026-05-05 15:02:40 -04:00
net: common metrics init helper for dst_entry
ipv4 and ipv6 both use refcounted metrics if FIB entries have metrics set. Move the common initialization code to a helper and use for both protocols. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
cc5f0eb216
commit
e1255ed4b6
@@ -429,6 +429,18 @@ static inline void ip_fib_metrics_put(struct dst_metrics *fib_metrics)
|
||||
kfree(fib_metrics);
|
||||
}
|
||||
|
||||
/* ipv4 and ipv6 both use refcounted metrics if it is not the default */
|
||||
static inline
|
||||
void ip_dst_init_metrics(struct dst_entry *dst, struct dst_metrics *fib_metrics)
|
||||
{
|
||||
dst_init_metrics(dst, fib_metrics->metrics, true);
|
||||
|
||||
if (fib_metrics != &dst_default_metrics) {
|
||||
dst->_metrics |= DST_METRICS_REFCOUNTED;
|
||||
refcount_inc(&fib_metrics->refcnt);
|
||||
}
|
||||
}
|
||||
|
||||
u32 ip_idents_reserve(u32 hash, int segs);
|
||||
void __ip_select_ident(struct net *net, struct iphdr *iph, int segs);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user