summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/kernel/net.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/kernel/net.c b/src/kernel/net.c
index e8c7cad..b229164 100644
--- a/src/kernel/net.c
+++ b/src/kernel/net.c
@@ -401,7 +401,7 @@ static void dnbd3_panic_worker(struct work_struct *work)
static int dnbd3_meassure_rtt(struct dnbd3_device *dev,
struct dnbd3_server *server)
{
- struct timeval start, end;
+ u64 start, end;
dnbd3_reply_t reply;
int result;
uint64_t rtt = RTT_UNREACHABLE;
@@ -443,7 +443,7 @@ static int dnbd3_meassure_rtt(struct dnbd3_device *dev,
}
- do_gettimeofday(&start);
+ start = ktime_get_ns();
result = dnbd3_send_request_cmd(&sock, CMD_GET_BLOCK);
if (result <= 0) {
error_sock(&sock, "request test block failed in rtt measurement");
@@ -461,10 +461,9 @@ static int dnbd3_meassure_rtt(struct dnbd3_device *dev,
error_sock(&sock, "receive test block failed in rtt measurement");
goto error;
}
- do_gettimeofday(&end); // end rtt measurement
+ end = ktime_get_ns(); // end rtt measurement
- rtt = (uint64_t)((end.tv_sec - start.tv_sec) * 1000000ull
- + (end.tv_usec - start.tv_usec));
+ rtt = (end - start) / 1000; // ns to us
error: