ipv6: Make fib6_nh optional at the end of fib6_info
Move fib6_nh to the end of fib6_info and make it an array of size 0. Pass a flag to fib6_info_alloc indicating if the allocation needs to add space for a fib6_nh. The current code path always has a fib6_nh allocated with a fib6_info; with nexthop objects they will be separate. 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
cc5c073a69
commit
1cf844c747
@@ -169,8 +169,8 @@ struct fib6_info {
|
||||
fib6_destroying:1,
|
||||
unused:3;
|
||||
|
||||
struct fib6_nh fib6_nh;
|
||||
struct rcu_head rcu;
|
||||
struct fib6_nh fib6_nh[0];
|
||||
};
|
||||
|
||||
struct rt6_info {
|
||||
@@ -280,7 +280,7 @@ static inline void ip6_rt_put(struct rt6_info *rt)
|
||||
dst_release(&rt->dst);
|
||||
}
|
||||
|
||||
struct fib6_info *fib6_info_alloc(gfp_t gfp_flags);
|
||||
struct fib6_info *fib6_info_alloc(gfp_t gfp_flags, bool with_fib6_nh);
|
||||
void fib6_info_destroy_rcu(struct rcu_head *head);
|
||||
|
||||
static inline void fib6_info_hold(struct fib6_info *f6i)
|
||||
@@ -443,7 +443,7 @@ void rt6_get_prefsrc(const struct rt6_info *rt, struct in6_addr *addr)
|
||||
|
||||
static inline struct net_device *fib6_info_nh_dev(const struct fib6_info *f6i)
|
||||
{
|
||||
return f6i->fib6_nh.fib_nh_dev;
|
||||
return f6i->fib6_nh->fib_nh_dev;
|
||||
}
|
||||
|
||||
int fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh,
|
||||
|
Reference in New Issue
Block a user