summaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2018-04-17 20:33:27 -0400
committerDavid S. Miller <davem@davemloft.net>2018-04-17 23:41:18 -0400
commit77634cc67dc1ffc8ae6d869af6dee4b2ea6025ee (patch)
tree1afc177ac88677e08348b2cb9eb4201d73b324f7 /net/ipv6/route.c
parent8d1c802b2815edc97af8a58c5045ebaf3848621a (diff)
net/ipv6: Remove unused code and variables for rt6_info
Drop unneeded elements from rt6_info struct and rearrange layout to something more relevant for the data path. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 2ccf939e1a20..f9c363327d62 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -302,10 +302,6 @@ static const struct rt6_info ip6_null_entry_template = {
302 .output = ip6_pkt_discard_out, 302 .output = ip6_pkt_discard_out,
303 }, 303 },
304 .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP), 304 .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP),
305 .rt6i_protocol = RTPROT_KERNEL,
306 .rt6i_metric = ~(u32) 0,
307 .rt6i_ref = ATOMIC_INIT(1),
308 .fib6_type = RTN_UNREACHABLE,
309}; 305};
310 306
311#ifdef CONFIG_IPV6_MULTIPLE_TABLES 307#ifdef CONFIG_IPV6_MULTIPLE_TABLES
@@ -320,10 +316,6 @@ static const struct rt6_info ip6_prohibit_entry_template = {
320 .output = ip6_pkt_prohibit_out, 316 .output = ip6_pkt_prohibit_out,
321 }, 317 },
322 .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP), 318 .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP),
323 .rt6i_protocol = RTPROT_KERNEL,
324 .rt6i_metric = ~(u32) 0,
325 .rt6i_ref = ATOMIC_INIT(1),
326 .fib6_type = RTN_PROHIBIT,
327}; 319};
328 320
329static const struct rt6_info ip6_blk_hole_entry_template = { 321static const struct rt6_info ip6_blk_hole_entry_template = {
@@ -336,10 +328,6 @@ static const struct rt6_info ip6_blk_hole_entry_template = {
336 .output = dst_discard_out, 328 .output = dst_discard_out,
337 }, 329 },
338 .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP), 330 .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP),
339 .rt6i_protocol = RTPROT_KERNEL,
340 .rt6i_metric = ~(u32) 0,
341 .rt6i_ref = ATOMIC_INIT(1),
342 .fib6_type = RTN_BLACKHOLE,
343}; 331};
344 332
345#endif 333#endif
@@ -349,7 +337,6 @@ static void rt6_info_init(struct rt6_info *rt)
349 struct dst_entry *dst = &rt->dst; 337 struct dst_entry *dst = &rt->dst;
350 338
351 memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst)); 339 memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst));
352 INIT_LIST_HEAD(&rt->rt6i_siblings);
353 INIT_LIST_HEAD(&rt->rt6i_uncached); 340 INIT_LIST_HEAD(&rt->rt6i_uncached);
354} 341}
355 342
@@ -999,12 +986,10 @@ static void ip6_rt_copy_init(struct rt6_info *rt, struct fib6_info *ort)
999 rt->rt6i_gateway = ort->fib6_nh.nh_gw; 986 rt->rt6i_gateway = ort->fib6_nh.nh_gw;
1000 rt->rt6i_flags = ort->rt6i_flags; 987 rt->rt6i_flags = ort->rt6i_flags;
1001 rt6_set_from(rt, ort); 988 rt6_set_from(rt, ort);
1002 rt->rt6i_metric = ort->rt6i_metric;
1003#ifdef CONFIG_IPV6_SUBTREES 989#ifdef CONFIG_IPV6_SUBTREES
1004 rt->rt6i_src = ort->rt6i_src; 990 rt->rt6i_src = ort->rt6i_src;
1005#endif 991#endif
1006 rt->rt6i_prefsrc = ort->rt6i_prefsrc; 992 rt->rt6i_prefsrc = ort->rt6i_prefsrc;
1007 rt->rt6i_table = ort->rt6i_table;
1008 rt->dst.lwtstate = lwtstate_get(ort->fib6_nh.nh_lwtstate); 993 rt->dst.lwtstate = lwtstate_get(ort->fib6_nh.nh_lwtstate);
1009} 994}
1010 995
@@ -1192,7 +1177,6 @@ static struct rt6_info *ip6_rt_cache_alloc(struct fib6_info *ort,
1192 1177
1193 ip6_rt_copy_init(rt, ort); 1178 ip6_rt_copy_init(rt, ort);
1194 rt->rt6i_flags |= RTF_CACHE; 1179 rt->rt6i_flags |= RTF_CACHE;
1195 rt->rt6i_metric = 0;
1196 rt->dst.flags |= DST_HOST; 1180 rt->dst.flags |= DST_HOST;
1197 rt->rt6i_dst.addr = *daddr; 1181 rt->rt6i_dst.addr = *daddr;
1198 rt->rt6i_dst.plen = 128; 1182 rt->rt6i_dst.plen = 128;
@@ -1225,7 +1209,6 @@ static struct rt6_info *ip6_rt_pcpu_alloc(struct fib6_info *rt)
1225 if (!pcpu_rt) 1209 if (!pcpu_rt)
1226 return NULL; 1210 return NULL;
1227 ip6_rt_copy_init(pcpu_rt, rt); 1211 ip6_rt_copy_init(pcpu_rt, rt);
1228 pcpu_rt->rt6i_protocol = rt->rt6i_protocol;
1229 pcpu_rt->rt6i_flags |= RTF_PCPU; 1212 pcpu_rt->rt6i_flags |= RTF_PCPU;
1230 return pcpu_rt; 1213 return pcpu_rt;
1231} 1214}
@@ -1279,9 +1262,8 @@ static void rt6_remove_exception(struct rt6_exception_bucket *bucket,
1279 return; 1262 return;
1280 1263
1281 net = dev_net(rt6_ex->rt6i->dst.dev); 1264 net = dev_net(rt6_ex->rt6i->dst.dev);
1282 rt6_ex->rt6i->rt6i_node = NULL;
1283 hlist_del_rcu(&rt6_ex->hlist); 1265 hlist_del_rcu(&rt6_ex->hlist);
1284 ip6_rt_put(rt6_ex->rt6i); 1266 dst_release(&rt6_ex->rt6i->dst);
1285 kfree_rcu(rt6_ex, rcu); 1267 kfree_rcu(rt6_ex, rcu);
1286 WARN_ON_ONCE(!bucket->depth); 1268 WARN_ON_ONCE(!bucket->depth);
1287 bucket->depth--; 1269 bucket->depth--;
@@ -1463,8 +1445,6 @@ static int rt6_insert_exception(struct rt6_info *nrt,
1463 } 1445 }
1464 rt6_ex->rt6i = nrt; 1446 rt6_ex->rt6i = nrt;
1465 rt6_ex->stamp = jiffies; 1447 rt6_ex->stamp = jiffies;
1466 atomic_inc(&nrt->rt6i_ref);
1467 nrt->rt6i_node = ort->rt6i_node;
1468 hlist_add_head_rcu(&rt6_ex->hlist, &bucket->chain); 1448 hlist_add_head_rcu(&rt6_ex->hlist, &bucket->chain);
1469 bucket->depth++; 1449 bucket->depth++;
1470 net->ipv6.rt6_stats->fib_rt_cache++; 1450 net->ipv6.rt6_stats->fib_rt_cache++;
@@ -2122,7 +2102,6 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori
2122 rt->rt6i_idev = in6_dev_get(loopback_dev); 2102 rt->rt6i_idev = in6_dev_get(loopback_dev);
2123 rt->rt6i_gateway = ort->rt6i_gateway; 2103 rt->rt6i_gateway = ort->rt6i_gateway;
2124 rt->rt6i_flags = ort->rt6i_flags & ~RTF_PCPU; 2104 rt->rt6i_flags = ort->rt6i_flags & ~RTF_PCPU;
2125 rt->rt6i_metric = 0;
2126 2105
2127 memcpy(&rt->rt6i_dst, &ort->rt6i_dst, sizeof(struct rt6key)); 2106 memcpy(&rt->rt6i_dst, &ort->rt6i_dst, sizeof(struct rt6key));
2128#ifdef CONFIG_IPV6_SUBTREES 2107#ifdef CONFIG_IPV6_SUBTREES
@@ -2247,8 +2226,7 @@ static void rt6_do_update_pmtu(struct rt6_info *rt, u32 mtu)
2247static bool rt6_cache_allowed_for_pmtu(const struct rt6_info *rt) 2226static bool rt6_cache_allowed_for_pmtu(const struct rt6_info *rt)
2248{ 2227{
2249 return !(rt->rt6i_flags & RTF_CACHE) && 2228 return !(rt->rt6i_flags & RTF_CACHE) &&
2250 (rt->rt6i_flags & RTF_PCPU || 2229 (rt->rt6i_flags & RTF_PCPU || rt->from);
2251 rcu_access_pointer(rt->rt6i_node));
2252} 2230}
2253 2231
2254static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk, 2232static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
@@ -3313,7 +3291,6 @@ static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_bu
3313 if (on_link) 3291 if (on_link)
3314 nrt->rt6i_flags &= ~RTF_GATEWAY; 3292 nrt->rt6i_flags &= ~RTF_GATEWAY;
3315 3293
3316 nrt->rt6i_protocol = RTPROT_REDIRECT;
3317 nrt->rt6i_gateway = *(struct in6_addr *)neigh->primary_key; 3294 nrt->rt6i_gateway = *(struct in6_addr *)neigh->primary_key;
3318 3295
3319 /* No need to remove rt from the exception table if rt is 3296 /* No need to remove rt from the exception table if rt is