From patchwork Fri Sep 29 19:47:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 9978599 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 BAF4960329 for ; Fri, 29 Sep 2017 19:48:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADAF3298AD for ; Fri, 29 Sep 2017 19:48:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2969298AF; Fri, 29 Sep 2017 19:48:31 +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=-4.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID, URIBL_BLACK 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 9D539298AE for ; Fri, 29 Sep 2017 19:48:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752589AbdI2Ts2 (ORCPT ); Fri, 29 Sep 2017 15:48:28 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:54215 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752542AbdI2TsN (ORCPT ); Fri, 29 Sep 2017 15:48:13 -0400 Received: by mail-oi0-f66.google.com with SMTP id j126so1071524oia.10 for ; Fri, 29 Sep 2017 12:48:13 -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=7VuADooxBItS8QSm+u6CrRTIbtttBoVLLrUKajnE8I0=; b=b1kS2vflx7YII/5IGwwj9dganldVZHE+AtS47eyP3MB9Fc+aspxaYcLd7I6XkxcVQN tKV5xnwf1I4q2cgM9J79ppBjdGy5rrizrve+6uCVB60IfFOvIlzWEmhbzoGTx4+1Rid+ f85mh4nkcY07+eDt+dL1XthC3ixVWhri5cFtf8CYg6np+yKo+gbcCVQT7YvAvK4DuoA3 typfWm2U6LSIdPBSHPaV12eMHDyN21G5i1j6XLBU3E0AewvYdveshLwPngpEuT7ZHcJb XFdKSyq87rcD2oZ+l2+aBBHWOwr1x5UcmZi+w8zrg7YOO3G5gPvIdiMngo3HjDy0MM3n Cg7A== 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=7VuADooxBItS8QSm+u6CrRTIbtttBoVLLrUKajnE8I0=; b=axLL1oBxqQaI4OR8oZAFZ8FULSr5kvuZj1m9LBgNCr8ZMIwvtjIQlltPVaf7J4kYJ1 NPAVRNOBjlPDxmznlulZyKqpxGwWKRMFXa65LSL5slOZEPw42xUnyVPUWoFl0dSz4OPd UqV90n1HT3P2oCtKPO0G7h1fGLOSVYPpx/m1Q51PXCLy7y4+Gv4+m6/Bs3rLy6BzBv3Z EM9C5X0McdTBdMBjn1+G/Qh+yghl36d/k+Bw7mzGerJ9j6WZ97IIcrhcHYdrfb7Ts5Z5 zGfGdQuATs2NCabg7KDj2XIbMuMcbHXYblYfZfwe5mluumUb1l6/VgnVJ8XwG8IX7NHY qe9Q== X-Gm-Message-State: AMCzsaUcDFMPxa4/Bt3xlQoyfOLTQTImZe16cx/BHZX1y3GNddvr/zoU UM5qoO0bQZ3ZtzgyRl4TSws= X-Google-Smtp-Source: AOwi7QBRgZkKxsSxfnIwZOr0aDoxxJjcJeW2Yh6XBgxcekpB7PgJLKF9NAHB1vUSnzwerRL/CPFqLQ== X-Received: by 10.202.51.10 with SMTP id z10mr3082192oiz.172.1506714493404; Fri, 29 Sep 2017 12:48:13 -0700 (PDT) Received: from Larrylap.localdomain (cpe-24-31-251-255.kc.res.rr.com. [24.31.251.255]) by smtp.gmail.com with ESMTPSA id v14sm2311062oif.39.2017.09.29.12.48.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Sep 2017 12:48:12 -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 06/10] rtlwifi: Add TX/RX throughput statistics in period Date: Fri, 29 Sep 2017 14:47:56 -0500 Message-Id: <20170929194800.15617-7-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170929194800.15617-1-Larry.Finger@lwfinger.net> References: <20170929194800.15617-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 --- 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 081b9507e02e..e28261bc2c27 100644 --- a/drivers/net/wireless/realtek/rtlwifi/base.c +++ b/drivers/net/wireless/realtek/rtlwifi/base.c @@ -1998,6 +1998,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 809648d28f52..ceeca79acc56 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