From patchwork Mon Jul 17 15:09:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 9845437 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2041160386 for ; Mon, 17 Jul 2017 15:10:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 132D028429 for ; Mon, 17 Jul 2017 15:10:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06D84284D2; Mon, 17 Jul 2017 15:10:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A78F428429 for ; Mon, 17 Jul 2017 15:10:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751392AbdGQPK0 (ORCPT ); Mon, 17 Jul 2017 11:10:26 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:34465 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751325AbdGQPKK (ORCPT ); Mon, 17 Jul 2017 11:10:10 -0400 Received: by mail-oi0-f67.google.com with SMTP id d77so18146639oig.1 for ; Mon, 17 Jul 2017 08:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Pegfk1NXvR8sT2/pvl9hXnv1vbXEx81J7OEKx/WPNDI=; b=c8GGv4Y6y0VL40tlWxHV/bXj2D5K4AFUJAswtIDoZZAdnNoBN0ouRU7YGHIpsXAfTD dZ0x81KwtDJ6cTCSoB14LfV+a8e0JfVBIVr6aaUamsFV5cwFeMwnlAaw8Q4MGN6NYPKP HUC8T/EiQYMI4cBsjxIyWhjlXibtsqEQ7r25a6NtZLIYWu6NPYxobIHEbb+H9JqISUsG OpxMsIRHR54Il7UwUVXWXqFLRT6M+LxIwsD0icYHten5Tn3WlnZ0bHaw2UzFDezPUB/s Fkf+H0x/IEe1Z/hRD00/CtP5q2bKGp52uIsxM5zlL5/+J5VZkAKs+2MjEB6f+TTUW2Rk hWow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Pegfk1NXvR8sT2/pvl9hXnv1vbXEx81J7OEKx/WPNDI=; b=XjofqiEurX1MMJlWGXA5NaSLmVcTIHHKakW56NDc56aBW9GHOQJv7Eu4TqKgWvDKQy rgkcYfi/zfhObSz2ebrUgjKky/z+NQGWLJXaoLU3JYBq7AzkXyJcGsVZLrx1hBOzemH5 3Mgh6U1XQABZsG3f1leWsQ8WN7uvMikSXYAlGEsykQ1T/wcZGzcCsWMSk+8mjJ2V2Blk pPE3K2nCOIbPq8Z4ONd0eEHsZv5Edn56WvBjGWbtVr9qF3A3IISsSyxENnlZAcSEl4eo LK9Sj1hpf6RXHSu/+gz3PouiJfslJLqy8MRFa3WQEyxL4EQlMzLDvHl03BKHvaNOE824 IwHQ== X-Gm-Message-State: AIVw110SrZo1IH6I11LzN7S5VYAUER/7yvH/4IK7nLkT9rrjYqM6FMRY XJcqwYeYrE4j+g== X-Received: by 10.202.223.194 with SMTP id w185mr13470711oig.108.1500304209678; Mon, 17 Jul 2017 08:10:09 -0700 (PDT) Received: from linux-4v1g.suse (cpe-24-31-249-175.kc.res.rr.com. [24.31.249.175]) by smtp.gmail.com with ESMTPSA id p65sm29370656oie.8.2017.07.17.08.10.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Jul 2017 08:10:09 -0700 (PDT) From: Larry Finger To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, Ping-Ke Shih , Larry Finger , Yan-Hsuan Chuang , Birming Chiu , Shaofu , Steven Ting Subject: [PATCH v2 07/11] rtlwifi: Add TX/RX throughput statistics in period Date: Mon, 17 Jul 2017 10:09:50 -0500 Message-Id: <20170717150954.1441-8-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20170717150954.1441-1-Larry.Finger@lwfinger.net> References: <20170717150954.1441-1-Larry.Finger@lwfinger.net> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ping-Ke Shih The statistic variables use u64 to get higher precision. Signed-off-by: Ping-Ke Shih Signed-off-by: Larry Finger Cc: Yan-Hsuan Chuang Cc: Birming Chiu Cc: Shaofu Cc: Steven Ting --- v2 - no changes --- drivers/net/wireless/realtek/rtlwifi/base.c | 16 ++++++++++++++++ drivers/net/wireless/realtek/rtlwifi/wifi.h | 15 +++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c index 9e6fcdde7475..f6baa2d00c72 100644 --- a/drivers/net/wireless/realtek/rtlwifi/base.c +++ b/drivers/net/wireless/realtek/rtlwifi/base.c @@ -1999,6 +1999,22 @@ void rtl_watchdog_wq_callback(void *data) rtlpriv->link_info.tx_busy_traffic = tx_busy_traffic; rtlpriv->link_info.higher_busyrxtraffic = higher_busyrxtraffic; + rtlpriv->stats.txbytesunicast_inperiod = + rtlpriv->stats.txbytesunicast - + rtlpriv->stats.txbytesunicast_last; + rtlpriv->stats.rxbytesunicast_inperiod = + rtlpriv->stats.rxbytesunicast - + rtlpriv->stats.rxbytesunicast_last; + rtlpriv->stats.txbytesunicast_last = rtlpriv->stats.txbytesunicast; + rtlpriv->stats.rxbytesunicast_last = rtlpriv->stats.rxbytesunicast; + + rtlpriv->stats.txbytesunicast_inperiod_tp = + (u32)(rtlpriv->stats.txbytesunicast_inperiod * 8 / 2 / + 1024 / 1024); + rtlpriv->stats.rxbytesunicast_inperiod_tp = + (u32)(rtlpriv->stats.rxbytesunicast_inperiod * 8 / 2 / + 1024 / 1024); + /* <3> DM */ if (!rtlpriv->cfg->mod_params->disable_watchdog) rtlpriv->cfg->ops->dm_watchdog(hw); diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h index 90f3c019bc04..8d8e104507d6 100644 --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h @@ -1013,10 +1013,17 @@ struct init_gain { }; struct wireless_stats { - unsigned long txbytesunicast; - unsigned long txbytesmulticast; - unsigned long txbytesbroadcast; - unsigned long rxbytesunicast; + u64 txbytesunicast; + u64 txbytesmulticast; + u64 txbytesbroadcast; + u64 rxbytesunicast; + + u64 txbytesunicast_inperiod; + u64 rxbytesunicast_inperiod; + u32 txbytesunicast_inperiod_tp; + u32 rxbytesunicast_inperiod_tp; + u64 txbytesunicast_last; + u64 rxbytesunicast_last; long rx_snr_db[4]; /*Correct smoothed ss in Dbm, only used