From patchwork Mon Nov 6 14:03:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 118056 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2801826qgn; Mon, 6 Nov 2017 06:04:43 -0800 (PST) X-Google-Smtp-Source: ABhQp+R10Q+f7XllpTyBgcs+S5835Hn1DuL4fxeDEdyQuEXJPGUaNM1Z9pn0MLWobDEWDryUK2xT X-Received: by 10.101.88.140 with SMTP id d12mr15612005pgu.166.1509977083056; Mon, 06 Nov 2017 06:04:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509977083; cv=none; d=google.com; s=arc-20160816; b=QTI5w01tPI41PfZ9kaJaQQ7uNFGOWQOkg1zPyXpC3WJhbMvJDhfmZxn1jJtgXesixM 8RLUI4OnQG+PfQVQDwAHPX1KaP7+I+iGI9V04fT+zrVZzTAYw+pzz4bSc9qWrCi+RkVi pmTY5RT6DplVZZFouJWDd/oE/FDRCuLPUTi4DZoBq7KVDTI0dvPpbGHrCRIAljh3FMKz qL1KRNSQtrbR4g8Gt7SAFo2GhM5TDkTC4fQYFSYWMoht57rX+dl1OlBomtRKvxtqweJf SmhrsIlTpjTatYoAk1kMZGkxgvA6N5dkX8eyxjjuielg1oFl7gXU48P4kMOshSa7Q99+ hSLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=kl8wK6HSFSQcvG0Y/dqJMn8CPXYeVY04iDfKzC2r0hc=; b=QKsPVlUPv4KhtNPK+2p7iBHmN/2C1U9wuku+C4vNDuJ19yS/6SlYGZM6wT3qByiXoK /sEGcH8rcIXqahl3BWfr6AI5BhgK8rliCGSpUXSGtttjqfNHDA341W2QKXxoaJrEWqpb fI+nDB4EilJ2Zqvn2/9emlEyfByqWL3BXFB0lbLMUtPMpiRCY2LvRhsYTnZqTGan9IqH nJZeG4VdDRJ755zTffBrVKxzh5aUWQKHi/tm/cKcg8QdYO8NapJdPRYXO8OxkUF3jL5C QJSPjvOGx1zTdKP6vQLPQv4Ka9BAXt08sxYizTxcvO0NCaHF/tPxOm9/jSNwNyxT7aiZ C2LQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u27si12085129pfd.358.2017.11.06.06.04.42; Mon, 06 Nov 2017 06:04:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753407AbdKFOEk (ORCPT + 26 others); Mon, 6 Nov 2017 09:04:40 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:53247 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753055AbdKFOEi (ORCPT ); Mon, 6 Nov 2017 09:04:38 -0500 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0Me0wT-1ebE1F1CPd-00PaGR; Mon, 06 Nov 2017 15:04:16 +0100 From: Arnd Bergmann To: Stanislaw Gruszka , Helmut Schaa , Kalle Valo Cc: Arnd Bergmann , Johannes Berg , "David S. Miller" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] rt2x00: use monotonic timestamps for frame dump Date: Mon, 6 Nov 2017 15:03:59 +0100 Message-Id: <20171106140412.1532617-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:Eu/7rPE57CIrONU3HFPR4g4hDk9RcOGWaBQ75dlthTxklLwZsyU SNIgmiWYx7M0SWHeK4uFBGZ1AwLnpg+RXNKUQ0DWjcJxVUP47t1GHkC9rUZe7PSQda4yh+i vDGOMgLlryEMhHQ48L84uuFvwdzDI1fh25xS80UjHedgYhaqw2Lzvgw/KN2Ev09rBzVqqm7 h4iXpFrlT8fF8i4UDl+yA== X-UI-Out-Filterresults: notjunk:1; V01:K0:BGvLKl1Q0p8=:aDXgZW4Jee0xaDm+N6FU7i mOhD3Njbj5BkDfC8RFHMq+0c5GHhsfUSA5UppO+n+/VUpsAK6BOYTJfgKG1BGbWfS/dB8Tvl4 gJb+Qhd6C/iwGS2O35cYSMz+nwftBvMMo5U+ZprJage71rTk7TivAOkq15qEAGbKFI6nxlMwA 3sOnI3MJt08eMNKE2k5rvo8q+S7cTdcvkrc60umFRDTjFf32KQVA1YbV13HGFa3Ir88U7+5KE mOE7n3ZjfaX0/X5Zdc+7mf2GBSLuWTni9/WcwuNgb9KlrBNJAkaNHK59q9Lq2NkcZ1XZfDMZp oMXhyIi+iP0JciNBECB7YAja1P9bsqTl/FLHBZzSJVuJ0fgmT4JzjRsDlg9nIQ5f6ZMSUDh9a MAVTV/sPwmC9jwKhjcDcl7f0AEKbvDXzR6O8G48a8kiCYuXL7o9o/zm/WibqIscSVXrS0/EIi F556ShHi9+mpWyzyJ0D0pLCbek8iuSRJ8Qcxo9YdgRt704jZz3tdPctiG/HNe198DJ37mnf6k Ktja/2gdew6h+doOlXRhIwbMZ5JBOQjup9RfBqwBFCOxsak6WjweyTmEpSC+js76fmkswljlF s9kW+5rq1R8aTuLDxkHZWh6dfXMVm/l05IdbcwjfebrmPj2wu7DrF6BPadaNSrl1qAS1T9FXN BnBZHH2LKw7yJ01Z+jqfhPq0nfFtZ6c1OdgLQtjsoEuVGg3JcbkB/mEXOUcrZhbMCfQVO1OS5 FGEvb7rUIL14D23eVBuH4L8vMoEQNMk0It7snw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org rt2x00 uses the deprecated do_gettimeofday() function to get a timestamp for its debugfs "dump" file interface. The timestamp is using an unsigned 32-bit value, so we could make it work until 2106 by using ktime_get_real_ts64(), but it seems better to use monotonic times, as we normally want for timestamps. Since this is an interface change, I'm incrementing the DUMP_HEADER_VERSION number, so user space can figure out whether the timestamps are monotonic or not. Most likely the tools won't care either way. Generally speaking, ABI version numbers and in particular changing them is a bad idea. However since this is in debugfs, we don't put any API stability rules on the interface according to Documentation/filesystems/debugfs.txt, and we can take the easy way out here; anyone using the frame dump feature can probably work out the differences here. Signed-off-by: Arnd Bergmann --- drivers/net/wireless/ralink/rt2x00/rt2x00debug.c | 7 ++++--- drivers/net/wireless/ralink/rt2x00/rt2x00dump.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) -- 2.9.0 diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c index 51520a0e2138..f4fdad2ed319 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c @@ -164,13 +164,13 @@ void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); struct sk_buff *skbcopy; struct rt2x00dump_hdr *dump_hdr; - struct timeval timestamp; + struct timespec64 timestamp; u32 data_len; if (likely(!test_bit(FRAME_DUMP_FILE_OPEN, &intf->frame_dump_flags))) return; - do_gettimeofday(×tamp); + ktime_get_ts64(×tamp); if (skb_queue_len(&intf->frame_dump_skbqueue) > 20) { rt2x00_dbg(rt2x00dev, "txrx dump queue length exceeded\n"); @@ -200,7 +200,8 @@ void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, dump_hdr->queue_index = entry->queue->qid; dump_hdr->entry_index = entry->entry_idx; dump_hdr->timestamp_sec = cpu_to_le32(timestamp.tv_sec); - dump_hdr->timestamp_usec = cpu_to_le32(timestamp.tv_usec); + dump_hdr->timestamp_usec = cpu_to_le32(timestamp.tv_nsec / + NSEC_PER_USEC); if (!(skbdesc->flags & SKBDESC_DESC_IN_SKB)) skb_put_data(skbcopy, skbdesc->desc, skbdesc->desc_len); diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00dump.h b/drivers/net/wireless/ralink/rt2x00/rt2x00dump.h index 4c0e01b5d515..3b14eef0b646 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dump.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dump.h @@ -106,7 +106,7 @@ enum rt2x00_dump_type { */ struct rt2x00dump_hdr { __le32 version; -#define DUMP_HEADER_VERSION 2 +#define DUMP_HEADER_VERSION 3 __le32 header_length; __le32 desc_length;