diff options
author | Patrick McHardy <kaber@trash.net> | 2011-01-14 08:12:37 -0500 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2011-01-14 08:12:37 -0500 |
commit | 0134e89c7bcc9fde1da962c82a120691e185619f (patch) | |
tree | 3e03335cf001019a2687d161e956de4f73379984 /include/net/dst.h | |
parent | c7066f70d9610df0b9406cc635fc09e86136e714 (diff) | |
parent | 6faee60a4e82075853a437831768cc9e2e563e4e (diff) |
Merge branch 'master' of git://1984.lsi.us.es/net-next-2.6
Conflicts:
net/ipv4/route.c
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'include/net/dst.h')
-rw-r--r-- | include/net/dst.h | 60 |
1 files changed, 50 insertions, 10 deletions
diff --git a/include/net/dst.h b/include/net/dst.h index 6baba836ad8b..be5a0d4c491d 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -70,7 +70,7 @@ struct dst_entry { | |||
70 | 70 | ||
71 | struct dst_ops *ops; | 71 | struct dst_ops *ops; |
72 | 72 | ||
73 | u32 metrics[RTAX_MAX]; | 73 | u32 _metrics[RTAX_MAX]; |
74 | 74 | ||
75 | #ifdef CONFIG_IP_ROUTE_CLASSID | 75 | #ifdef CONFIG_IP_ROUTE_CLASSID |
76 | __u32 tclassid; | 76 | __u32 tclassid; |
@@ -104,9 +104,49 @@ struct dst_entry { | |||
104 | #ifdef __KERNEL__ | 104 | #ifdef __KERNEL__ |
105 | 105 | ||
106 | static inline u32 | 106 | static inline u32 |
107 | dst_metric(const struct dst_entry *dst, int metric) | 107 | dst_metric_raw(const struct dst_entry *dst, const int metric) |
108 | { | 108 | { |
109 | return dst->metrics[metric-1]; | 109 | return dst->_metrics[metric-1]; |
110 | } | ||
111 | |||
112 | static inline u32 | ||
113 | dst_metric(const struct dst_entry *dst, const int metric) | ||
114 | { | ||
115 | WARN_ON_ONCE(metric == RTAX_HOPLIMIT || | ||
116 | metric == RTAX_ADVMSS || | ||
117 | metric == RTAX_MTU); | ||
118 | return dst_metric_raw(dst, metric); | ||
119 | } | ||
120 | |||
121 | static inline u32 | ||
122 | dst_metric_advmss(const struct dst_entry *dst) | ||
123 | { | ||
124 | u32 advmss = dst_metric_raw(dst, RTAX_ADVMSS); | ||
125 | |||
126 | if (!advmss) | ||
127 | advmss = dst->ops->default_advmss(dst); | ||
128 | |||
129 | return advmss; | ||
130 | } | ||
131 | |||
132 | static inline void dst_metric_set(struct dst_entry *dst, int metric, u32 val) | ||
133 | { | ||
134 | dst->_metrics[metric-1] = val; | ||
135 | } | ||
136 | |||
137 | static inline void dst_import_metrics(struct dst_entry *dst, const u32 *src_metrics) | ||
138 | { | ||
139 | memcpy(dst->_metrics, src_metrics, RTAX_MAX * sizeof(u32)); | ||
140 | } | ||
141 | |||
142 | static inline void dst_copy_metrics(struct dst_entry *dest, const struct dst_entry *src) | ||
143 | { | ||
144 | dst_import_metrics(dest, src->_metrics); | ||
145 | } | ||
146 | |||
147 | static inline u32 *dst_metrics_ptr(struct dst_entry *dst) | ||
148 | { | ||
149 | return dst->_metrics; | ||
110 | } | 150 | } |
111 | 151 | ||
112 | static inline u32 | 152 | static inline u32 |
@@ -117,11 +157,11 @@ dst_feature(const struct dst_entry *dst, u32 feature) | |||
117 | 157 | ||
118 | static inline u32 dst_mtu(const struct dst_entry *dst) | 158 | static inline u32 dst_mtu(const struct dst_entry *dst) |
119 | { | 159 | { |
120 | u32 mtu = dst_metric(dst, RTAX_MTU); | 160 | u32 mtu = dst_metric_raw(dst, RTAX_MTU); |
121 | /* | 161 | |
122 | * Alexey put it here, so ask him about it :) | 162 | if (!mtu) |
123 | */ | 163 | mtu = dst->ops->default_mtu(dst); |
124 | barrier(); | 164 | |
125 | return mtu; | 165 | return mtu; |
126 | } | 166 | } |
127 | 167 | ||
@@ -134,7 +174,7 @@ static inline unsigned long dst_metric_rtt(const struct dst_entry *dst, int metr | |||
134 | static inline void set_dst_metric_rtt(struct dst_entry *dst, int metric, | 174 | static inline void set_dst_metric_rtt(struct dst_entry *dst, int metric, |
135 | unsigned long rtt) | 175 | unsigned long rtt) |
136 | { | 176 | { |
137 | dst->metrics[metric-1] = jiffies_to_msecs(rtt); | 177 | dst_metric_set(dst, metric, jiffies_to_msecs(rtt)); |
138 | } | 178 | } |
139 | 179 | ||
140 | static inline u32 | 180 | static inline u32 |
@@ -147,7 +187,7 @@ dst_allfrag(const struct dst_entry *dst) | |||
147 | } | 187 | } |
148 | 188 | ||
149 | static inline int | 189 | static inline int |
150 | dst_metric_locked(struct dst_entry *dst, int metric) | 190 | dst_metric_locked(const struct dst_entry *dst, int metric) |
151 | { | 191 | { |
152 | return dst_metric(dst, RTAX_LOCK) & (1<<metric); | 192 | return dst_metric(dst, RTAX_LOCK) & (1<<metric); |
153 | } | 193 | } |