ipv6: Move exception bucket to fib6_nh
authorDavid Ahern <dsahern@gmail.com>
Thu, 23 May 2019 03:27:58 +0000 (20:27 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 24 May 2019 20:26:44 +0000 (13:26 -0700)
commitcc5c073a693fa6ed7a207b0436114f68cce72434
tree1fb7f4548614be447a54add7cae5d61d54466f9a
parentc0b220cf7d80eb8a36ae9f12cae6df4577a6814e
ipv6: Move exception bucket to fib6_nh

Similar to the pcpu routes exceptions are really per nexthop, so move
rt6i_exception_bucket from fib6_info to fib6_nh.

To avoid additional increases to the size of fib6_nh for a 1-bit flag,
use the lowest bit in the allocated memory pointer for the flushed flag.
Add helpers for retrieving the bucket pointer to mask off the flag.

The cleanup of the exception bucket is moved to fib6_nh_release.

fib6_nh_flush_exceptions can now be called from 2 contexts:
1. deleting a fib entry
2. deleting a fib6_nh

For 1., fib6_nh_flush_exceptions is called for a specific fib6_info that
is getting deleted. All exceptions in the cache using the entry are
deleted. For 2, the fib6_nh itself is getting destroyed so
fib6_nh_flush_exceptions is called for a NULL fib6_info which means
flush all entries.

The pmtu.sh selftest exercises the affected code paths - from creating
exceptions to cleaning them up on device delete. All tests pass without
any rcu locking or memleak warnings.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ip6_fib.h
net/ipv6/ip6_fib.c
net/ipv6/route.c