linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
To: linux-wireless@vger.kernel.org
Cc: Aviya Erenfeld <aviya.erenfeld@intel.com>,
	Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Subject: [PATCH 06/43] iwlwifi: add a debugfs hook for LQM
Date: Wed, 30 Mar 2016 17:04:38 +0300	[thread overview]
Message-ID: <1459346715-7954-6-git-send-email-emmanuel.grumbach@intel.com> (raw)
In-Reply-To: <1459346667.4731.9.camel@intel.com>

From: Aviya Erenfeld <aviya.erenfeld@intel.com>

Add debugfs entry named lqm_send_cmd for kicking a
measurement. This hook takes the duration and the timeout
as parameter.

Signed-off-by: Aviya Erenfeld <aviya.erenfeld@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 .../net/wireless/intel/iwlwifi/mvm/debugfs-vif.c   | 85 ++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
index 1400445..3a279d3 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
@@ -1425,6 +1425,89 @@ static ssize_t iwl_dbgfs_quota_min_read(struct file *file,
 	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
 }
 
+static const char * const chanwidths[] = {
+	[NL80211_CHAN_WIDTH_20_NOHT] = "noht",
+	[NL80211_CHAN_WIDTH_20] = "ht20",
+	[NL80211_CHAN_WIDTH_40] = "ht40",
+	[NL80211_CHAN_WIDTH_80] = "vht80",
+	[NL80211_CHAN_WIDTH_80P80] = "vht80p80",
+	[NL80211_CHAN_WIDTH_160] = "vht160",
+};
+
+static bool iwl_mvm_lqm_notif_wait(struct iwl_notif_wait_data *notif_wait,
+				   struct iwl_rx_packet *pkt, void *data)
+{
+	struct ieee80211_vif *vif = data;
+	struct iwl_mvm *mvm =
+		container_of(notif_wait, struct iwl_mvm, notif_wait);
+	struct iwl_link_qual_msrmnt_notif *report = (void *)pkt->data;
+	u32 num_of_stations = le32_to_cpu(report->number_of_stations);
+	int i;
+
+	IWL_INFO(mvm, "LQM report:\n");
+	IWL_INFO(mvm, "\tstatus: %d\n", report->status);
+	IWL_INFO(mvm, "\tmacID: %d\n", le32_to_cpu(report->mac_id));
+	IWL_INFO(mvm, "\ttx_frame_dropped: %d\n",
+		 le32_to_cpu(report->tx_frame_dropped));
+	IWL_INFO(mvm, "\ttime_in_measurement_window: %d us\n",
+		 le32_to_cpu(report->time_in_measurement_window));
+	IWL_INFO(mvm, "\ttotal_air_time_other_stations: %d\n",
+		 le32_to_cpu(report->total_air_time_other_stations));
+	IWL_INFO(mvm, "\tchannel_freq: %d\n",
+		 vif->bss_conf.chandef.center_freq1);
+	IWL_INFO(mvm, "\tchannel_width: %s\n",
+		 chanwidths[vif->bss_conf.chandef.width]);
+	IWL_INFO(mvm, "\tnumber_of_stations: %d\n", num_of_stations);
+	for (i = 0; i < num_of_stations; i++)
+		IWL_INFO(mvm, "\t\tsta[%d]: %d\n", i,
+			 report->frequent_stations_air_time[i]);
+
+	return true;
+}
+
+static ssize_t iwl_dbgfs_lqm_send_cmd_write(struct ieee80211_vif *vif,
+					    char *buf, size_t count,
+					    loff_t *ppos)
+{
+	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
+	struct iwl_mvm *mvm = mvmvif->mvm;
+	struct iwl_notification_wait wait_lqm_notif;
+	static u16 lqm_notif[] = {
+		WIDE_ID(MAC_CONF_GROUP,
+			LINK_QUALITY_MEASUREMENT_COMPLETE_NOTIF)
+	};
+	int err;
+	u32 duration;
+	u32 timeout;
+
+	if (sscanf(buf, "%d,%d", &duration, &timeout) != 2)
+		return -EINVAL;
+
+	iwl_init_notification_wait(&mvm->notif_wait, &wait_lqm_notif,
+				   lqm_notif, ARRAY_SIZE(lqm_notif),
+				   iwl_mvm_lqm_notif_wait, vif);
+	mutex_lock(&mvm->mutex);
+	err = iwl_mvm_send_lqm_cmd(vif, LQM_CMD_OPERATION_START_MEASUREMENT,
+				   duration, timeout);
+	mutex_unlock(&mvm->mutex);
+
+	if (err) {
+		IWL_ERR(mvm, "Failed to send lqm cmdf(err=%d)\n", err);
+		iwl_remove_notification(&mvm->notif_wait, &wait_lqm_notif);
+		return err;
+	}
+
+	/* wait for 2 * timeout (safety guard) and convert to jiffies*/
+	timeout = msecs_to_jiffies((timeout * 2) / 1000);
+
+	err = iwl_wait_notification(&mvm->notif_wait, &wait_lqm_notif,
+				    timeout);
+	if (err)
+		IWL_ERR(mvm, "Getting lqm notif timed out\n");
+
+	return count;
+}
+
 #define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \
 	_MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct ieee80211_vif)
 #define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \
@@ -1449,6 +1532,7 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(tof_range_abort, 32);
 MVM_DEBUGFS_READ_FILE_OPS(tof_range_response);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(tof_responder_params, 32);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(quota_min, 32);
+MVM_DEBUGFS_WRITE_FILE_OPS(lqm_send_cmd, 64);
 
 void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 {
@@ -1488,6 +1572,7 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 				 S_IRUSR | S_IWUSR);
 	MVM_DEBUGFS_ADD_FILE_VIF(quota_min, mvmvif->dbgfs_dir,
 				 S_IRUSR | S_IWUSR);
+	MVM_DEBUGFS_ADD_FILE_VIF(lqm_send_cmd, mvmvif->dbgfs_dir, S_IWUSR);
 
 	if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p &&
 	    mvmvif == mvm->bf_allowed_vif)
-- 
2.5.0


  parent reply	other threads:[~2016-03-30 14:05 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-30 14:04 pull request: iwlwifi-next 2016-03-30 Grumbach, Emmanuel
2016-03-30 14:04 ` [PATCH 01/43] iwlwifi: pcie: clear trans reference on queue stop Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 02/43] iwlwifi: mvm: Decrease size of the paging download buffer Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 03/43] iwlwifi: mvm: make sure FW contains the right amount of paging sections Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 04/43] iwlwifi: mvm: support dumping UMAC internal txfifos Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 05/43] iwlwifi: mvm: add LQM vendor command and notification Emmanuel Grumbach
2016-03-30 14:04 ` Emmanuel Grumbach [this message]
2016-03-30 14:04 ` [PATCH 07/43] iwlwifi: pcie: fix global table size Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 08/43] iwlwifi: pcie: enable interrupts explicitly on resume Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 09/43] iwlwifi: pcie: refcounting is not necessary anymore Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 10/43] iwlwifi: mvm: handle async temperature notification with unlocked mutex Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 11/43] iwlwifi: pcie: print error value as signed int Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 12/43] iwlwifi: mvm: modify the max SP to infinite Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 13/43] iwlwifi: pcie: do not pad QoS AMSDU Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 14/43] iwlwifi: mvm: add support for new TX CMD API Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 15/43] iwlwifi: add missing mutex_destroy statements Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 16/43] iwlwifi: make uapsd_disable module param a bitmap Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 17/43] iwlwifi: 9000: update device id and FW serial number Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 18/43] iwlwifi: mvm: remove is_data_qos variable in TX Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 19/43] iwlwifi: mvm: support bss dynamic alloc/dealloc of queues Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 20/43] iwlwifi: pcie: write to legacy register also in MQ Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 21/43] iwlwifi: remove IWLWIFI_UAPSD Kconfig Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 22/43] iwlwifi: mvm: update GSCAN capabilities Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 23/43] iwlwifi: remove support for fw older than -16.ucode Emmanuel Grumbach
2016-04-24  6:30   ` Pat Erley
2016-04-25 13:05     ` Kalle Valo
2016-03-30 14:04 ` [PATCH 24/43] iwlwifi: dvm: use alloc_ordered_workqueue() Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 25/43] iwlwifi: mvm: report checksum is done also for IPv6 packets Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 26/43] iwlwifi: mvm: set aux STA ID in scan config Emmanuel Grumbach
2016-03-30 14:04 ` [PATCH 27/43] iwlwifi: trans: fix iwl_trans_txq_scd_cfg.sta_id sign Emmanuel Grumbach
2016-03-30 14:05 ` [PATCH 28/43] iwlwifi: mvm: remove uneeded D0I3 checking Emmanuel Grumbach
2016-03-30 14:05 ` [PATCH 29/43] iwlwifi: pcie: request one more interrupt vector Emmanuel Grumbach
2016-03-30 14:05 ` [PATCH 30/43] iwlwifi: mvm: improve RSS configuration Emmanuel Grumbach
2016-03-30 14:05 ` [PATCH 31/43] iwlwifi: edit the 9000 series PCI IDs Emmanuel Grumbach
2016-03-30 14:05 ` [PATCH 32/43] iwlwifi: mvm: use bss client queue for bss station Emmanuel Grumbach
2016-03-30 14:05 ` [PATCH 33/43] iwlwifi: mvm: set sta_id in SCD_QUEUE_CONFIG cmd Emmanuel Grumbach
2016-03-30 14:05 ` [PATCH 34/43] iwlwifi: mvm: allocate dedicated queue for cab in dqa mode Emmanuel Grumbach
2016-03-30 14:05 ` [PATCH 35/43] iwlwifi: mvm: move cmd queue to be #0 " Emmanuel Grumbach
2016-03-30 14:05 ` [PATCH 36/43] iwlwifi: mvm: add a scan timeout for regular scans Emmanuel Grumbach
2016-03-30 14:05 ` [PATCH 37/43] iwlwifi: mvm: enable TCP/UDP checksum support for 9000 family Emmanuel Grumbach
2016-03-30 14:05 ` [PATCH 38/43] iwlwifi: remove IWL_*_UCODE_API_OK Emmanuel Grumbach
2016-03-30 14:05 ` [PATCH 39/43] iwlwifi: pcie: Fix index iteration on free_irq in MSIX mode Emmanuel Grumbach
2016-03-30 14:05 ` [PATCH 40/43] iwlwifi: store fw memory segments length and addresses in run-time Emmanuel Grumbach
2016-03-30 14:05 ` [PATCH 41/43] iwlwifi: mvm: fix inconsistent lock in dqa mode Emmanuel Grumbach
2016-03-30 14:05 ` [PATCH 42/43] iwlwifi: mvm: allow setting the thermal state in D0i3 Emmanuel Grumbach
2016-03-30 14:05 ` [PATCH 43/43] iwlwifi: pcie: remove duplicate assignment of variable isr_stats Emmanuel Grumbach
2016-04-06 18:17 ` pull request: iwlwifi-next 2016-03-30 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=1459346715-7954-6-git-send-email-emmanuel.grumbach@intel.com \
    --to=emmanuel.grumbach@intel.com \
    --cc=aviya.erenfeld@intel.com \
    --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).