linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Malcolm Priestley <tvboxspy@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-wireless@vger.kernel.org, Malcolm Priestley <tvboxspy@gmail.com>
Subject: [PATCH 1/2] staging: vt6656: implement get_stats ieee80211_low_level_stats
Date: Sun, 29 Jun 2014 20:39:54 +0100	[thread overview]
Message-ID: <1404070795-3034-1-git-send-email-tvboxspy@gmail.com> (raw)

The driver already report low_level_stats via vnt_interrupt_data.

Allow mac80211 to collect them via vnt_get_stats

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
 drivers/staging/vt6656/device.h   |  1 +
 drivers/staging/vt6656/int.c      |  6 ++++++
 drivers/staging/vt6656/main_usb.c | 11 +++++++++++
 3 files changed, 18 insertions(+)

diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index f1ed43e..4d1eb22 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -438,6 +438,7 @@ struct vnt_private {
 	u8 byChannelSwitchCount;
 
 	struct iw_statistics wstats; /* wireless stats */
+	struct ieee80211_low_level_stats low_stats;
 };
 
 #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) {   \
diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c
index 23d045c..1913b73 100644
--- a/drivers/staging/vt6656/int.c
+++ b/drivers/staging/vt6656/int.c
@@ -79,6 +79,7 @@ void INTnsProcessData(struct vnt_private *priv)
 {
 	struct vnt_interrupt_data *int_data;
 	struct net_device_stats *stats = &priv->stats;
+	struct ieee80211_low_level_stats *low_stats = &priv->low_stats;
 
 	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptProcessData\n");
 
@@ -133,6 +134,11 @@ void INTnsProcessData(struct vnt_private *priv)
 #endif
 		}
 		priv->qwCurrTSF = le64_to_cpu(int_data->tsf);
+
+		low_stats->dot11RTSSuccessCount += int_data->rts_success;
+		low_stats->dot11RTSFailureCount += int_data->rts_fail;
+		low_stats->dot11ACKFailureCount += int_data->ack_fail;
+		low_stats->dot11FCSErrorCount += int_data->fcs_err;
 	}
 
 	if (int_data->isr1 != 0)
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 14845ec..8a4695e 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -1006,6 +1006,16 @@ static void vnt_sw_scan_complete(struct ieee80211_hw *hw)
 	BBvUpdatePreEDThreshold(priv, false);
 }
 
+static int vnt_get_stats(struct ieee80211_hw *hw,
+				struct ieee80211_low_level_stats *stats)
+{
+	struct vnt_private *priv = hw->priv;
+
+	memcpy(stats, &priv->low_stats, sizeof(*stats));
+
+	return 0;
+}
+
 static u64 vnt_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 {
 	struct vnt_private *priv = hw->priv;
@@ -1043,6 +1053,7 @@ static const struct ieee80211_ops vnt_mac_ops = {
 	.set_key		= vnt_set_key,
 	.sw_scan_start		= vnt_sw_scan_start,
 	.sw_scan_complete	= vnt_sw_scan_complete,
+	.get_stats		= vnt_get_stats,
 	.get_tsf		= vnt_get_tsf,
 	.set_tsf		= vnt_set_tsf,
 	.reset_tsf		= vnt_reset_tsf,
-- 
1.9.1


             reply	other threads:[~2014-06-29 19:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-29 19:39 Malcolm Priestley [this message]
2014-06-29 19:39 ` [PATCH 2/2] staging: vt6656: s_nsBulkOutIoCompleteWrite fix bug of 5GHZ a rates idx Malcolm Priestley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1404070795-3034-1-git-send-email-tvboxspy@gmail.com \
    --to=tvboxspy@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).