summaryrefslogtreecommitdiff
path: root/include/net/dst.h
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2008-07-18 23:02:15 -0700
committerDavid S. Miller <davem@davemloft.net>2008-07-18 23:02:15 -0700
commitc1e20f7c8b9ccbafc9ea78f2b406738728ce6b81 (patch)
tree807dacbfdc6ebfde27ba4d4f46dd1572c4a07cde /include/net/dst.h
parent30ee42be00b7a50929a73cb617f70b1d3219eb69 (diff)
tcp: RTT metrics scaling
Some of the metrics (RTT, RTTVAR and RTAX_RTO_MIN) are stored in kernel units (jiffies) and this leaks out through the netlink API to user space where the units for jiffies are unknown. This patches changes the kernel to convert to/from milliseconds. This changes the ABI, but milliseconds seemed like the most natural unit for these parameters. Values available via syscall in /proc/net/rt_cache and netlink will be in milliseconds. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/dst.h')
-rw-r--r--include/net/dst.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/net/dst.h b/include/net/dst.h
index 002500e631f5..c5c318a628f8 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -128,6 +128,18 @@ static inline u32 dst_mtu(const struct dst_entry *dst)
return mtu;
}
+/* RTT metrics are stored in milliseconds for user ABI, but used as jiffies */
+static inline unsigned long dst_metric_rtt(const struct dst_entry *dst, int metric)
+{
+ return msecs_to_jiffies(dst_metric(dst, metric));
+}
+
+static inline void set_dst_metric_rtt(struct dst_entry *dst, int metric,
+ unsigned long rtt)
+{
+ dst->metrics[metric-1] = jiffies_to_msecs(rtt);
+}
+
static inline u32
dst_allfrag(const struct dst_entry *dst)
{