diff options
author | Arnd Bergmann <arnd@arndb.de> | 2018-08-29 11:47:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-09-01 22:52:50 -0400 |
commit | 2de9d505fb0d53676b6d595e8334a9dcdfda8d12 (patch) | |
tree | 5c60acce3f1fbfc0a819f889945285b0d660564e /net/rds | |
parent | c2ad647c6442cf6730ffd86cbadbbce101dea937 (diff) |
rds: store socket timestamps as ktime_t
rds is the last in-kernel user of the old do_gettimeofday()
function. Convert it over to ktime_get_real() to make it
work more like the generic socket timestamps, and to let
us kill off do_gettimeofday().
A follow-up patch will have to change the user space interface
to deal better with 32-bit tasks, which may use an incompatible
layout for 'struct timespec'.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds')
-rw-r--r-- | net/rds/rds.h | 2 | ||||
-rw-r--r-- | net/rds/recv.c | 14 |
2 files changed, 7 insertions, 9 deletions
diff --git a/net/rds/rds.h b/net/rds/rds.h index c4dcf654d8fe..6bfaf05b63b2 100644 --- a/net/rds/rds.h +++ b/net/rds/rds.h | |||
@@ -278,7 +278,7 @@ struct rds_incoming { | |||
278 | struct in6_addr i_saddr; | 278 | struct in6_addr i_saddr; |
279 | 279 | ||
280 | rds_rdma_cookie_t i_rdma_cookie; | 280 | rds_rdma_cookie_t i_rdma_cookie; |
281 | struct timeval i_rx_tstamp; | 281 | ktime_t i_rx_tstamp; |
282 | u64 i_rx_lat_trace[RDS_RX_MAX_TRACES]; | 282 | u64 i_rx_lat_trace[RDS_RX_MAX_TRACES]; |
283 | }; | 283 | }; |
284 | 284 | ||
diff --git a/net/rds/recv.c b/net/rds/recv.c index 504cd6bcc54c..12719653188a 100644 --- a/net/rds/recv.c +++ b/net/rds/recv.c | |||
@@ -50,8 +50,7 @@ void rds_inc_init(struct rds_incoming *inc, struct rds_connection *conn, | |||
50 | inc->i_conn = conn; | 50 | inc->i_conn = conn; |
51 | inc->i_saddr = *saddr; | 51 | inc->i_saddr = *saddr; |
52 | inc->i_rdma_cookie = 0; | 52 | inc->i_rdma_cookie = 0; |
53 | inc->i_rx_tstamp.tv_sec = 0; | 53 | inc->i_rx_tstamp = ktime_set(0, 0); |
54 | inc->i_rx_tstamp.tv_usec = 0; | ||
55 | 54 | ||
56 | for (i = 0; i < RDS_RX_MAX_TRACES; i++) | 55 | for (i = 0; i < RDS_RX_MAX_TRACES; i++) |
57 | inc->i_rx_lat_trace[i] = 0; | 56 | inc->i_rx_lat_trace[i] = 0; |
@@ -67,8 +66,7 @@ void rds_inc_path_init(struct rds_incoming *inc, struct rds_conn_path *cp, | |||
67 | inc->i_conn_path = cp; | 66 | inc->i_conn_path = cp; |
68 | inc->i_saddr = *saddr; | 67 | inc->i_saddr = *saddr; |
69 | inc->i_rdma_cookie = 0; | 68 | inc->i_rdma_cookie = 0; |
70 | inc->i_rx_tstamp.tv_sec = 0; | 69 | inc->i_rx_tstamp = ktime_set(0, 0); |
71 | inc->i_rx_tstamp.tv_usec = 0; | ||
72 | } | 70 | } |
73 | EXPORT_SYMBOL_GPL(rds_inc_path_init); | 71 | EXPORT_SYMBOL_GPL(rds_inc_path_init); |
74 | 72 | ||
@@ -385,7 +383,7 @@ void rds_recv_incoming(struct rds_connection *conn, struct in6_addr *saddr, | |||
385 | be32_to_cpu(inc->i_hdr.h_len), | 383 | be32_to_cpu(inc->i_hdr.h_len), |
386 | inc->i_hdr.h_dport); | 384 | inc->i_hdr.h_dport); |
387 | if (sock_flag(sk, SOCK_RCVTSTAMP)) | 385 | if (sock_flag(sk, SOCK_RCVTSTAMP)) |
388 | do_gettimeofday(&inc->i_rx_tstamp); | 386 | inc->i_rx_tstamp = ktime_get_real(); |
389 | rds_inc_addref(inc); | 387 | rds_inc_addref(inc); |
390 | inc->i_rx_lat_trace[RDS_MSG_RX_END] = local_clock(); | 388 | inc->i_rx_lat_trace[RDS_MSG_RX_END] = local_clock(); |
391 | list_add_tail(&inc->i_item, &rs->rs_recv_queue); | 389 | list_add_tail(&inc->i_item, &rs->rs_recv_queue); |
@@ -552,11 +550,11 @@ static int rds_cmsg_recv(struct rds_incoming *inc, struct msghdr *msg, | |||
552 | goto out; | 550 | goto out; |
553 | } | 551 | } |
554 | 552 | ||
555 | if ((inc->i_rx_tstamp.tv_sec != 0) && | 553 | if ((inc->i_rx_tstamp != 0) && |
556 | sock_flag(rds_rs_to_sk(rs), SOCK_RCVTSTAMP)) { | 554 | sock_flag(rds_rs_to_sk(rs), SOCK_RCVTSTAMP)) { |
555 | struct timeval tv = ktime_to_timeval(inc->i_rx_tstamp); | ||
557 | ret = put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMP, | 556 | ret = put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMP, |
558 | sizeof(struct timeval), | 557 | sizeof(tv), &tv); |
559 | &inc->i_rx_tstamp); | ||
560 | if (ret) | 558 | if (ret) |
561 | goto out; | 559 | goto out; |
562 | } | 560 | } |