All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: linux-wireless@vger.kernel.org
Cc: Sara Sharon <sara.sharon@intel.com>,
	Luca Coelho <luciano.coelho@intel.com>
Subject: [PATCH 26/56] iwlwifi: mvm: support new statistics notification
Date: Wed,  6 Jul 2016 13:40:21 +0300	[thread overview]
Message-ID: <1467801651-1816-26-git-send-email-luca@coelho.fi> (raw)
In-Reply-To: <1467801452.25088.20.camel@coelho.fi>

From: Sara Sharon <sara.sharon@intel.com>

For 9000 family we will get extended statistics notification
with averaged data for RSSI, TCM and rogue AP detection.
Support it. Future patches will added the required algorithms.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 .../net/wireless/intel/iwlwifi/mvm/fw-api-mac.h    |  3 +++
 .../net/wireless/intel/iwlwifi/mvm/fw-api-stats.h  | 24 +++++++++++++++++++-
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h    |  3 ---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c  |  5 +++++
 drivers/net/wireless/intel/iwlwifi/mvm/rx.c        | 26 ++++++++++++++++++++--
 drivers/net/wireless/intel/iwlwifi/mvm/sta.h       |  1 +
 6 files changed, 56 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-mac.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-mac.h
index 95ac59d..0246506 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-mac.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-mac.h
@@ -72,6 +72,9 @@
 #define NUM_MAC_INDEX_DRIVER	MAC_INDEX_AUX
 #define NUM_MAC_INDEX		(MAC_INDEX_AUX + 1)
 
+#define IWL_MVM_STATION_COUNT	16
+#define IWL_MVM_TDLS_STA_COUNT	4
+
 enum iwl_ac {
 	AC_BK,
 	AC_BE,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-stats.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-stats.h
index 438665a..4e638a4 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-stats.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-stats.h
@@ -7,6 +7,7 @@
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
+ * Copyright(c) 2016 Intel Deutschland GmbH
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -252,6 +253,20 @@ struct mvm_statistics_general_v8 {
 	u8 reserved[4 - (NUM_MAC_INDEX % 4)];
 } __packed; /* STATISTICS_GENERAL_API_S_VER_8 */
 
+/**
+ * struct mvm_statistics_load - RX statistics for multi-queue devices
+ * @air_time: accumulated air time, per mac
+ * @byte_count: accumulated byte count, per mac
+ * @pkt_count: accumulated packet count, per mac
+ * @avg_energy: average RSSI, per station
+ */
+struct mvm_statistics_load {
+	__le32 air_time[NUM_MAC_INDEX];
+	__le32 byte_count[NUM_MAC_INDEX];
+	__le32 pkt_count[NUM_MAC_INDEX];
+	u8 avg_energy[IWL_MVM_STATION_COUNT];
+} __packed; /* STATISTICS_RX_MAC_STATION_S_VER_1 */
+
 struct mvm_statistics_rx {
 	struct mvm_statistics_rx_phy ofdm;
 	struct mvm_statistics_rx_phy cck;
@@ -266,7 +281,6 @@ struct mvm_statistics_rx {
  * while associated.  To disable this behavior, set DISABLE_NOTIF flag in the
  * STATISTICS_CMD (0x9c), below.
  */
-
 struct iwl_notif_statistics_v10 {
 	__le32 flag;
 	struct mvm_statistics_rx rx;
@@ -274,6 +288,14 @@ struct iwl_notif_statistics_v10 {
 	struct mvm_statistics_general_v8 general;
 } __packed; /* STATISTICS_NTFY_API_S_VER_10 */
 
+struct iwl_notif_statistics_v11 {
+	__le32 flag;
+	struct mvm_statistics_rx rx;
+	struct mvm_statistics_tx tx;
+	struct mvm_statistics_general_v8 general;
+	struct mvm_statistics_load load_stats;
+} __packed; /* STATISTICS_NTFY_API_S_VER_11 */
+
 #define IWL_STATISTICS_FLG_CLEAR		0x1
 #define IWL_STATISTICS_FLG_DISABLE_NOTIF	0x2
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
index eea03ec..71076f0 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
@@ -129,9 +129,6 @@ enum iwl_mvm_tx_fifo {
 	IWL_MVM_TX_FIFO_CMD = 7,
 };
 
-#define IWL_MVM_STATION_COUNT	16
-
-#define IWL_MVM_TDLS_STA_COUNT	4
 
 /* commands */
 enum {
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 6b158f0..5c044ea 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -3922,6 +3922,11 @@ static void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw,
 	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
 	struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
 
+	if (mvmsta->avg_energy) {
+		sinfo->signal_avg = mvmsta->avg_energy;
+		sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL_AVG);
+	}
+
 	if (fw_has_capa(&mvm->fw->ucode_capa,
 			IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS))
 		return;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
index 2d5a7cc..0e60e38 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
@@ -498,6 +498,7 @@ struct iwl_mvm_stat_data {
 	__le32 mac_id;
 	u8 beacon_filter_average_energy;
 	struct mvm_statistics_general_v8 *general;
+	struct mvm_statistics_load *load;
 };
 
 static void iwl_mvm_stat_iterator(void *_data, u8 *mac,
@@ -614,13 +615,15 @@ iwl_mvm_rx_stats_check_trigger(struct iwl_mvm *mvm, struct iwl_rx_packet *pkt)
 void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm,
 				  struct iwl_rx_packet *pkt)
 {
-	struct iwl_notif_statistics_v10 *stats = (void *)&pkt->data;
+	struct iwl_notif_statistics_v11 *stats = (void *)&pkt->data;
 	struct iwl_mvm_stat_data data = {
 		.mvm = mvm,
 	};
+	int expected_size = iwl_mvm_has_new_rx_api(mvm) ? sizeof(*stats) :
+			    sizeof(struct iwl_notif_statistics_v10);
 	u32 temperature;
 
-	if (iwl_rx_packet_payload_len(pkt) != sizeof(*stats))
+	if (iwl_rx_packet_payload_len(pkt) != expected_size)
 		goto invalid;
 
 	temperature = le32_to_cpu(stats->general.radio_temperature);
@@ -638,6 +641,25 @@ void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm,
 		le64_to_cpu(stats->general.on_time_scan);
 
 	data.general = &stats->general;
+	if (iwl_mvm_has_new_rx_api(mvm)) {
+		int i;
+
+		data.load = &stats->load_stats;
+
+		rcu_read_lock();
+		for (i = 0; i < IWL_MVM_STATION_COUNT; i++) {
+			struct iwl_mvm_sta *sta;
+
+			if (!data.load->avg_energy[i])
+				continue;
+
+			sta = iwl_mvm_sta_from_staid_rcu(mvm, i);
+			if (!sta)
+				continue;
+			sta->avg_energy = data.load->avg_energy[i];
+		}
+		rcu_read_unlock();
+	}
 
 	iwl_mvm_rx_stats_check_trigger(mvm, pkt);
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
index 1588eb6..bbc1cab 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
@@ -438,6 +438,7 @@ struct iwl_mvm_sta {
 	bool tlc_amsdu;
 	u8 agg_tids;
 	u8 sleep_tx_count;
+	u8 avg_energy;
 };
 
 static inline struct iwl_mvm_sta *
-- 
2.8.1


  parent reply	other threads:[~2016-07-06 10:44 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-06 10:37 pull-request: iwlwifi-next 2016-07-06 Luca Coelho
2016-07-06 10:39 ` [PATCH 01/56] iwlwifi: remove useless enum values Luca Coelho
2016-07-06 10:39 ` [PATCH 02/56] iwlwifi: change fw.mvm_fw to fw.type Luca Coelho
2016-07-06 10:39 ` [PATCH 03/56] iwlwifi: mvm: support dqa queue inactivation upon timeout Luca Coelho
2016-07-06 10:39 ` [PATCH 04/56] iwlwifi: pcie: unify restock calls on init Luca Coelho
2016-07-06 10:40 ` [PATCH 05/56] iwlwifi: mvm: fix possible division by zero Luca Coelho
2016-07-06 10:40 ` [PATCH 06/56] iwlwifi: mvm: change scan timeout to a delayed work Luca Coelho
2016-07-06 10:40 ` [PATCH 07/56] iwlwifi: mvm: remove an unused variable Luca Coelho
2016-07-06 10:40 ` [PATCH 08/56] iwlwifi: mvm: silence uninitialized variable warning Luca Coelho
2016-07-06 10:40 ` [PATCH 09/56] iwlwifi: mvm: support dqa queue sharing Luca Coelho
2016-07-06 10:40 ` [PATCH 10/56] iwlwifi: mvm: set sta_id in SCD_QUEUE_CONFIG cmd Luca Coelho
2016-07-06 10:40 ` [PATCH 11/56] iwlwifi: mvm: update aux queue in dqa mode Luca Coelho
2016-07-06 10:40 ` [PATCH 12/56] iwlwifi: mvm: support dqa-enable hcmd Luca Coelho
2016-07-06 10:40 ` [PATCH 13/56] iwlwifi: add new 8260 PCI IDs Luca Coelho
2016-07-06 10:40 ` [PATCH 14/56] iwlwifi: add new 8265 Luca Coelho
2016-07-06 10:40 ` [PATCH 15/56] iwlwifi: mvm: remove unnecessary device conversion when reading the MCC Luca Coelho
2016-07-06 10:40 ` [PATCH 16/56] iwlwifi: pcie: poll RFH for RX DMA stop Luca Coelho
2016-07-06 10:40 ` [PATCH 17/56] iwlwifi: mvm: Do not open aggregations for null data packets Luca Coelho
2016-07-06 10:40 ` [PATCH 18/56] iwlwifi: mvm: fix RX mpdu status enum Luca Coelho
2016-07-06 10:40 ` [PATCH 19/56] iwlwifi: mvm: rs: add rate scaling support for 160MHz channels Luca Coelho
2016-07-06 10:40 ` [PATCH 20/56] iwlwifi: mvm: avoid harmless -Wmaybe-uninialized warning Luca Coelho
2016-07-06 10:40 ` [PATCH 21/56] iwlwifi: mvm: fix txq aggregation bug Luca Coelho
2016-07-06 10:40 ` [PATCH 22/56] iwlwifi: dvm: Remove unused array 'iwlagn_loose_lookup' Luca Coelho
2016-07-06 10:40 ` [PATCH 23/56] iwlwifi: add dump of RFH Luca Coelho
2016-07-06 10:40 ` [PATCH 24/56] iwlwifi: Reserve iwl_fw_error_dump_type enum Luca Coelho
2016-07-06 10:40 ` [PATCH 25/56] iwlwifi: mvm: add support for GCMP encryption Luca Coelho
2016-07-06 10:40 ` Luca Coelho [this message]
2016-07-06 10:40 ` [PATCH 27/56] iwlwifi: Add a000 HW family support Luca Coelho
2016-07-06 10:40 ` [PATCH 28/56] iwlwifi: pcie: enable interrupts before releasing the NIC's CPU Luca Coelho
2016-07-06 10:40 ` [PATCH 29/56] iwlmvm: mvm: set correct state in smart-fifo configuration Luca Coelho
2016-07-06 10:40 ` [PATCH 30/56] iwlwifi: mvm: checksum IPv6 fragmented packet Luca Coelho
2016-07-06 10:40 ` [PATCH 31/56] iwlwifi: mvm: cleanup the coex code Luca Coelho
2016-07-06 10:40 ` [PATCH 32/56] iwlwifi: mvm: read SAR BIOS table from ACPI Luca Coelho
2016-07-06 10:40 ` [PATCH 33/56] iwlwifi: pcie: Enable MSI mode when using MSI interrupts Luca Coelho
2016-07-06 10:40 ` [PATCH 34/56] iwlwifi: pcie: fix access to scratch buffer Luca Coelho
2016-07-06 10:40 ` [PATCH 35/56] iwlwifi: mvm: write the correct internal TXF index Luca Coelho
2016-07-06 10:40 ` [PATCH 36/56] iwlwifi: mvm: fix coex related comments Luca Coelho
2016-07-06 10:40 ` [PATCH 37/56] iwlwifi: mvm: fix the channel inhibition table for Channel 14 Luca Coelho
2016-07-06 10:40 ` [PATCH 38/56] iwlwifi: remove iwl_ht_params.smps_mode Luca Coelho
2016-07-06 10:40 ` [PATCH 39/56] iwlwifi: mvm: unmap the paging memory before freeing it Luca Coelho
2016-07-06 10:40 ` [PATCH 40/56] iwlwifi: pcie: don't use vid 0 Luca Coelho
2016-07-06 10:40 ` [PATCH 41/56] iwlwifi: mvm: support tdls in dqa mode Luca Coelho
2016-07-06 10:40 ` [PATCH 42/56] iwlwifi: mvm: support dqa-mode scd queue redirection Luca Coelho
2016-07-06 10:40 ` [PATCH 43/56] iwlwifi: mvm: add RX aggregation prints Luca Coelho
2016-07-06 10:40 ` [PATCH 44/56] iwlwifi: mvm: free RX reorder buffer on restart Luca Coelho
2016-07-06 10:40 ` [PATCH 45/56] iwlwifi: store cipher scheme independent of mac80211 Luca Coelho
2016-07-06 10:40 ` [PATCH 46/56] iwlwifi: tracing: decouple from mac80211 Luca Coelho
2016-07-06 10:40 ` [PATCH 47/56] iwlwifi: decouple PCIe transport " Luca Coelho
2016-07-06 10:40 ` [PATCH 48/56] iwlwifi: pcie: fix a race in firmware loading flow Luca Coelho
2016-07-06 10:40 ` [PATCH 49/56] iwlwifi: pcie: track rxb status Luca Coelho
2016-07-06 10:40 ` [PATCH 50/56] iwlwifi: pcie: generalize and increase the size of scratchbuf Luca Coelho
2016-07-06 10:40 ` [PATCH 51/56] iwlwifi: centralize 64 bit HW registers write Luca Coelho
2016-07-06 10:40 ` [PATCH 52/56] iwlwifi: pcie: initialize a000 device's TFD table Luca Coelho
2016-07-06 10:40 ` [PATCH 53/56] iwlwifi: pcie: load FW chunk for a000 devices Luca Coelho
2016-07-06 10:40 ` [PATCH 54/56] iwlwifi: mvm: support v4 of the TX power command Luca Coelho
2016-07-06 10:40 ` [PATCH 55/56] iwlwifi: pcie: centralize SCD status logging Luca Coelho
2016-07-06 10:40 ` [PATCH 56/56] iwlwifi: move iwl_drv to be shared across transports Luca Coelho
2016-07-08  9:21 ` pull-request: iwlwifi-next 2016-07-06 Kalle Valo

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=1467801651-1816-26-git-send-email-luca@coelho.fi \
    --to=luca@coelho.fi \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    --cc=sara.sharon@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.