diff options
author | David S. Miller <davem@davemloft.net> | 2012-07-13 11:21:29 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-13 11:21:29 -0400 |
commit | 85b91b0339e764f7e56ff5968fa10d85451378b4 (patch) | |
tree | 539c368948900b35ee8d474829724a796b482d44 /net/ipv4 | |
parent | d01cb20711e3c2df41677ee270d6bdeff24e9902 (diff) |
ipv4: Don't store a rule pointer in fib_result.
We only use it to fetch the rule's tclassid, so just store the
tclassid there instead.
This also decreases the size of fib_result by a full 8 bytes on
64-bit. On 32-bits it's a wash.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/fib_frontend.c | 8 | ||||
-rw-r--r-- | net/ipv4/fib_rules.c | 15 | ||||
-rw-r--r-- | net/ipv4/route.c | 6 |
3 files changed, 8 insertions, 21 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 81f85716a894..7a31194ec633 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -169,10 +169,6 @@ static inline unsigned int __inet_dev_addr_type(struct net *net, | |||
169 | if (ipv4_is_multicast(addr)) | 169 | if (ipv4_is_multicast(addr)) |
170 | return RTN_MULTICAST; | 170 | return RTN_MULTICAST; |
171 | 171 | ||
172 | #ifdef CONFIG_IP_MULTIPLE_TABLES | ||
173 | res.r = NULL; | ||
174 | #endif | ||
175 | |||
176 | local_table = fib_get_table(net, RT_TABLE_LOCAL); | 172 | local_table = fib_get_table(net, RT_TABLE_LOCAL); |
177 | if (local_table) { | 173 | if (local_table) { |
178 | ret = RTN_UNICAST; | 174 | ret = RTN_UNICAST; |
@@ -934,10 +930,6 @@ static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb) | |||
934 | .flowi4_scope = frn->fl_scope, | 930 | .flowi4_scope = frn->fl_scope, |
935 | }; | 931 | }; |
936 | 932 | ||
937 | #ifdef CONFIG_IP_MULTIPLE_TABLES | ||
938 | res.r = NULL; | ||
939 | #endif | ||
940 | |||
941 | frn->err = -ENOENT; | 933 | frn->err = -ENOENT; |
942 | if (tb) { | 934 | if (tb) { |
943 | local_bh_disable(); | 935 | local_bh_disable(); |
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index c06da93b0b70..a83d74e498d2 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c | |||
@@ -47,13 +47,6 @@ struct fib4_rule { | |||
47 | #endif | 47 | #endif |
48 | }; | 48 | }; |
49 | 49 | ||
50 | #ifdef CONFIG_IP_ROUTE_CLASSID | ||
51 | u32 fib_rules_tclass(const struct fib_result *res) | ||
52 | { | ||
53 | return res->r ? ((struct fib4_rule *) res->r)->tclassid : 0; | ||
54 | } | ||
55 | #endif | ||
56 | |||
57 | int __fib_lookup(struct net *net, struct flowi4 *flp, struct fib_result *res) | 50 | int __fib_lookup(struct net *net, struct flowi4 *flp, struct fib_result *res) |
58 | { | 51 | { |
59 | struct fib_lookup_arg arg = { | 52 | struct fib_lookup_arg arg = { |
@@ -63,8 +56,12 @@ int __fib_lookup(struct net *net, struct flowi4 *flp, struct fib_result *res) | |||
63 | int err; | 56 | int err; |
64 | 57 | ||
65 | err = fib_rules_lookup(net->ipv4.rules_ops, flowi4_to_flowi(flp), 0, &arg); | 58 | err = fib_rules_lookup(net->ipv4.rules_ops, flowi4_to_flowi(flp), 0, &arg); |
66 | res->r = arg.rule; | 59 | #ifdef CONFIG_IP_ROUTE_CLASSID |
67 | 60 | if (arg.rule) | |
61 | res->tclassid = ((struct fib4_rule *)arg.rule)->tclassid; | ||
62 | else | ||
63 | res->tclassid = 0; | ||
64 | #endif | ||
68 | return err; | 65 | return err; |
69 | } | 66 | } |
70 | EXPORT_SYMBOL_GPL(__fib_lookup); | 67 | EXPORT_SYMBOL_GPL(__fib_lookup); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 9319bf1f8354..aad21819316d 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1735,7 +1735,7 @@ static void rt_set_nexthop(struct rtable *rt, const struct flowi4 *fl4, | |||
1735 | 1735 | ||
1736 | #ifdef CONFIG_IP_ROUTE_CLASSID | 1736 | #ifdef CONFIG_IP_ROUTE_CLASSID |
1737 | #ifdef CONFIG_IP_MULTIPLE_TABLES | 1737 | #ifdef CONFIG_IP_MULTIPLE_TABLES |
1738 | set_class_tag(rt, fib_rules_tclass(res)); | 1738 | set_class_tag(rt, res->tclassid); |
1739 | #endif | 1739 | #endif |
1740 | set_class_tag(rt, itag); | 1740 | set_class_tag(rt, itag); |
1741 | #endif | 1741 | #endif |
@@ -2353,11 +2353,9 @@ static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4) | |||
2353 | __be32 orig_saddr; | 2353 | __be32 orig_saddr; |
2354 | int orig_oif; | 2354 | int orig_oif; |
2355 | 2355 | ||
2356 | res.tclassid = 0; | ||
2356 | res.fi = NULL; | 2357 | res.fi = NULL; |
2357 | res.table = NULL; | 2358 | res.table = NULL; |
2358 | #ifdef CONFIG_IP_MULTIPLE_TABLES | ||
2359 | res.r = NULL; | ||
2360 | #endif | ||
2361 | 2359 | ||
2362 | orig_daddr = fl4->daddr; | 2360 | orig_daddr = fl4->daddr; |
2363 | orig_saddr = fl4->saddr; | 2361 | orig_saddr = fl4->saddr; |