diff options
author | David S. Miller <davem@davemloft.net> | 2010-12-14 16:01:14 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-14 16:01:14 -0500 |
commit | d33e455337ea2c71d09d7f4367d6ad6dd32b6965 (patch) | |
tree | d1b35b1be5ab73df6f7e57b86a2e68fad2990adf /net/decnet/dn_route.c | |
parent | 9fe146aef44afe5ec677d8150b6ae94e09b773f7 (diff) |
net: Abstract default MTU metric calculation behind an accessor.
Like RTAX_ADVMSS, make the default calculation go through a dst_ops
method rather than caching the computation in the routing cache
entries.
Now dst metrics are pretty much left as-is when new entries are
created, thus optimizing metric sharing becomes a real possibility.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/decnet/dn_route.c')
-rw-r--r-- | net/decnet/dn_route.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index b8a5c0515be8..5e636365d33c 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -111,6 +111,7 @@ static unsigned long dn_rt_deadline; | |||
111 | static int dn_dst_gc(struct dst_ops *ops); | 111 | static int dn_dst_gc(struct dst_ops *ops); |
112 | static struct dst_entry *dn_dst_check(struct dst_entry *, __u32); | 112 | static struct dst_entry *dn_dst_check(struct dst_entry *, __u32); |
113 | static unsigned int dn_dst_default_advmss(const struct dst_entry *dst); | 113 | static unsigned int dn_dst_default_advmss(const struct dst_entry *dst); |
114 | static unsigned int dn_dst_default_mtu(const struct dst_entry *dst); | ||
114 | static struct dst_entry *dn_dst_negative_advice(struct dst_entry *); | 115 | static struct dst_entry *dn_dst_negative_advice(struct dst_entry *); |
115 | static void dn_dst_link_failure(struct sk_buff *); | 116 | static void dn_dst_link_failure(struct sk_buff *); |
116 | static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu); | 117 | static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu); |
@@ -131,6 +132,7 @@ static struct dst_ops dn_dst_ops = { | |||
131 | .gc = dn_dst_gc, | 132 | .gc = dn_dst_gc, |
132 | .check = dn_dst_check, | 133 | .check = dn_dst_check, |
133 | .default_advmss = dn_dst_default_advmss, | 134 | .default_advmss = dn_dst_default_advmss, |
135 | .default_mtu = dn_dst_default_mtu, | ||
134 | .negative_advice = dn_dst_negative_advice, | 136 | .negative_advice = dn_dst_negative_advice, |
135 | .link_failure = dn_dst_link_failure, | 137 | .link_failure = dn_dst_link_failure, |
136 | .update_pmtu = dn_dst_update_pmtu, | 138 | .update_pmtu = dn_dst_update_pmtu, |
@@ -803,6 +805,11 @@ static unsigned int dn_dst_default_advmss(const struct dst_entry *dst) | |||
803 | return dn_mss_from_pmtu(dst->dev, dst_mtu(dst)); | 805 | return dn_mss_from_pmtu(dst->dev, dst_mtu(dst)); |
804 | } | 806 | } |
805 | 807 | ||
808 | static unsigned int dn_dst_default_mtu(const struct dst_entry *dst) | ||
809 | { | ||
810 | return dst->dev->mtu; | ||
811 | } | ||
812 | |||
806 | static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res) | 813 | static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res) |
807 | { | 814 | { |
808 | struct dn_fib_info *fi = res->fi; | 815 | struct dn_fib_info *fi = res->fi; |
@@ -825,8 +832,7 @@ static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res) | |||
825 | rt->dst.neighbour = n; | 832 | rt->dst.neighbour = n; |
826 | } | 833 | } |
827 | 834 | ||
828 | if (dst_metric(&rt->dst, RTAX_MTU) == 0 || | 835 | if (dst_metric(&rt->dst, RTAX_MTU) > rt->dst.dev->mtu) |
829 | dst_metric(&rt->dst, RTAX_MTU) > rt->dst.dev->mtu) | ||
830 | dst_metric_set(&rt->dst, RTAX_MTU, rt->dst.dev->mtu); | 836 | dst_metric_set(&rt->dst, RTAX_MTU, rt->dst.dev->mtu); |
831 | metric = dst_metric_raw(&rt->dst, RTAX_ADVMSS); | 837 | metric = dst_metric_raw(&rt->dst, RTAX_ADVMSS); |
832 | if (metric) { | 838 | if (metric) { |