From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: luca@coelho.fi, linux-wireless@vger.kernel.org
Subject: [PATCH v2 09/12] iwlwifi: mvm: add fixed_rate debugfs entry to public DHC
Date: Thu, 26 Aug 2021 22:47:45 +0300 [thread overview]
Message-ID: <iwlwifi.20210826224715.9cc9edb80dc4.I9d93ef704af34daed3c2075dfc3841ed03b9e590@changeid> (raw)
In-Reply-To: <20210826194748.826360-1-luca@coelho.fi>
From: Luca Coelho <luciano.coelho@intel.com>
Expose the fixed_rate debugfs entry wnen IWLWIFI_DHC_PUBLIC is
enabled.
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
.../net/wireless/intel/iwlwifi/fw/api/dhc.h | 12 ++++-
.../net/wireless/intel/iwlwifi/fw/api/rs.h | 40 ++++++++++++++--
.../net/wireless/intel/iwlwifi/mvm/debugfs.c | 46 +++++++++++++++++++
.../net/wireless/intel/iwlwifi/mvm/rs-fw.c | 33 +++++++++++++
drivers/net/wireless/intel/iwlwifi/mvm/rs.h | 10 ++--
5 files changed, 130 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/dhc.h b/drivers/net/wireless/intel/iwlwifi/fw/api/dhc.h
index 3ffc5904056f..481c942db2ec 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/dhc.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/dhc.h
@@ -22,7 +22,17 @@ enum iwl_dhc_table_id {
enum iwl_dhc_umac_integration_table {
/* @DHC_INT_UMAC_TWT_OPERATION: trigger a TWT operation */
DHC_INT_UMAC_TWT_OPERATION = 4,
- /* @DHC_INTEGRATION_MAX: Maximum UMAC integration table entries */
+ /**
+ * @DHC_INTEGRATION_TLC_DEBUG_CONFIG: TLC debug
+ */
+ DHC_INTEGRATION_TLC_DEBUG_CONFIG = 1,
+ /**
+ * @DHC_INT_UMAC_TWT_CONTROL: TWT hooks (like disable internal TWT triggers)
+ */
+ DHC_INT_UMAC_TWT_CONTROL = 10,
+ /**
+ * @DHC_INTEGRATION_MAX: Maximum UMAC integration table entries
+ */
DHC_INTEGRATION_MAX
};
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/rs.h b/drivers/net/wireless/intel/iwlwifi/fw/api/rs.h
index fc2fa49e9825..f23766df236b 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/rs.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/rs.h
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/*
- * Copyright (C) 2012-2014, 2018-2020 Intel Corporation
+ * Copyright (C) 2012-2014, 2018-2021 Intel Corporation
* Copyright (C) 2017 Intel Deutschland GmbH
*/
#ifndef __iwl_fw_api_rs_h__
@@ -184,8 +184,42 @@ struct iwl_tlc_update_notif {
__le32 amsdu_enabled;
} __packed; /* TLC_MNG_UPDATE_NTFY_API_S_VER_2 */
-/*
- * These serve as indexes into
+#ifdef CONFIG_IWLWIFI_DHC
+/**
+ * enum iwl_tlc_debug_types - debug options
+ */
+enum iwl_tlc_debug_types {
+ /* @IWL_TLC_DEBUG_FIXED_RATE: set fixed rate for rate scaling */
+ IWL_TLC_DEBUG_FIXED_RATE,
+}; /* TLC_MNG_DEBUG_TYPES_API_E */
+#endif /* CONFIG_IWLWIFI_DHC */
+
+#ifdef CONFIG_IWLWIFI_DHC
+#define MAX_DATA_IN_DHC_TLC_CMD 10
+
+/**
+ * struct iwl_dhc_tlc_dbg - fixed debug config
+ * @sta_id: bit 0 - enable/disable, bits 1 - 7 hold station id
+ * @reserved1: reserved
+ * @type: type id of %enum iwl_tlc_debug_types
+ * @data: data to send
+ */
+struct iwl_dhc_tlc_cmd {
+ u8 sta_id;
+ u8 reserved1[3];
+ __le32 type;
+ __le32 data[MAX_DATA_IN_DHC_TLC_CMD];
+} __packed; /* TLC_MNG_DEBUG_CMD_S */
+#endif /* CONFIG_IWLWIFI_DHC */
+
+#define IWL_MAX_MCS_DISPLAY_SIZE 12
+
+struct iwl_rate_mcs_info {
+ char mbps[IWL_MAX_MCS_DISPLAY_SIZE];
+ char mcs[IWL_MAX_MCS_DISPLAY_SIZE];
+};
+
+/* These serve as indexes into
* struct iwl_rate_info fw_rate_idx_to_plcp[IWL_RATE_COUNT];
* TODO: avoid overlap between legacy and HT rates
*/
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
index 5dc39fbb74d6..86a4dcd21681 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
@@ -414,6 +414,46 @@ static ssize_t iwl_dbgfs_rs_data_read(struct file *file, char __user *user_buf,
return ret;
}
+#ifdef CONFIG_IWLWIFI_DHC
+static void iwl_rs_set_fixed_rate(struct iwl_mvm *mvm,
+ struct iwl_lq_sta_rs_fw *lq_sta)
+{
+ int ret = iwl_rs_send_dhc(mvm, lq_sta,
+ IWL_TLC_DEBUG_FIXED_RATE,
+ lq_sta->pers.dbg_fixed_rate);
+
+ char pretty_rate[100];
+
+ if (ret) {
+ lq_sta->pers.dbg_fixed_rate = 0;
+ return;
+ }
+
+ rs_pretty_print_rate(pretty_rate, sizeof(pretty_rate),
+ lq_sta->pers.dbg_fixed_rate);
+ IWL_DEBUG_RATE(mvm, "sta_id %d rate %s\n",
+ lq_sta->pers.sta_id, pretty_rate);
+}
+
+static ssize_t iwl_dbgfs_fixed_rate_write(struct ieee80211_sta *sta,
+ char *buf, size_t count,
+ loff_t *ppos)
+{
+ struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
+ struct iwl_lq_sta_rs_fw *lq_sta = &mvmsta->lq_sta.rs_fw;
+ struct iwl_mvm *mvm = lq_sta->pers.drv;
+ u32 parsed_rate;
+
+ if (kstrtou32(buf, 0, &parsed_rate))
+ lq_sta->pers.dbg_fixed_rate = 0;
+ else
+ lq_sta->pers.dbg_fixed_rate = parsed_rate;
+
+ iwl_rs_set_fixed_rate(mvm, lq_sta);
+ return count;
+}
+#endif /* CONFIG_IWLWIFI_DHC */
+
static ssize_t iwl_dbgfs_amsdu_len_write(struct ieee80211_sta *sta,
char *buf, size_t count,
loff_t *ppos)
@@ -1889,6 +1929,9 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(bcast_filters_macs, 256);
MVM_DEBUGFS_READ_FILE_OPS(sar_geo_profile);
#endif
+#ifdef CONFIG_IWLWIFI_DHC
+MVM_DEBUGFS_WRITE_STA_FILE_OPS(fixed_rate, 64);
+#endif
MVM_DEBUGFS_READ_WRITE_STA_FILE_OPS(amsdu_len, 16);
MVM_DEBUGFS_READ_WRITE_FILE_OPS(he_sniffer_params, 32);
@@ -2037,6 +2080,9 @@ void iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw,
if (iwl_mvm_has_tlc_offload(mvm)) {
MVM_DEBUGFS_ADD_STA_FILE(rs_data, dir, 0400);
+#ifdef CONFIG_IWLWIFI_DHC
+ MVM_DEBUGFS_ADD_STA_FILE(fixed_rate, dir, 0200);
+#endif
}
MVM_DEBUGFS_ADD_STA_FILE(amsdu_len, dir, 0600);
}
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
index 2d58cb969918..dc12d8890021 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
@@ -359,6 +359,39 @@ void iwl_mvm_tlc_update_notif(struct iwl_mvm *mvm,
rcu_read_unlock();
}
+#ifdef CONFIG_IWLWIFI_DHC
+int iwl_rs_send_dhc(struct iwl_mvm *mvm, struct iwl_lq_sta_rs_fw *lq_sta,
+ u32 type, u32 data)
+{
+ int ret;
+ struct iwl_dhc_cmd *dhc_cmd;
+ struct iwl_dhc_tlc_cmd *dhc_tlc_cmd;
+ u32 cmd_id = iwl_cmd_id(DEBUG_HOST_COMMAND, IWL_ALWAYS_LONG_GROUP, 0);
+
+ dhc_cmd = kzalloc(sizeof(*dhc_cmd) + sizeof(*dhc_tlc_cmd), GFP_KERNEL);
+ if (!dhc_cmd)
+ return -ENOMEM;
+
+ dhc_tlc_cmd = (void *)dhc_cmd->data;
+ dhc_tlc_cmd->sta_id = lq_sta->pers.sta_id;
+ dhc_tlc_cmd->type = cpu_to_le32(type);
+ dhc_tlc_cmd->data[0] = cpu_to_le32(data);
+ dhc_cmd->length = cpu_to_le32(sizeof(*dhc_tlc_cmd) >> 2);
+ dhc_cmd->index_and_mask =
+ cpu_to_le32(DHC_TABLE_INTEGRATION | DHC_TARGET_UMAC |
+ DHC_INTEGRATION_TLC_DEBUG_CONFIG);
+
+ ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, CMD_ASYNC,
+ sizeof(*dhc_cmd) + sizeof(*dhc_tlc_cmd),
+ dhc_cmd);
+ if (ret)
+ IWL_ERR(mvm, "Failed to send TLC Debug command: %d\n", ret);
+
+ kfree(dhc_cmd);
+ return ret;
+}
+#endif /* CONFIG_IWLWIFI_DHC */
+
u16 rs_fw_get_max_amsdu_len(struct ieee80211_sta *sta)
{
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.h b/drivers/net/wireless/intel/iwlwifi/mvm/rs.h
index 32104c9f8f5e..2b72d477a46f 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.h
@@ -211,13 +211,6 @@ struct rs_rate {
#define is_ht80(rate) ((rate)->bw == RATE_MCS_CHAN_WIDTH_80)
#define is_ht160(rate) ((rate)->bw == RATE_MCS_CHAN_WIDTH_160)
-#define IWL_MAX_MCS_DISPLAY_SIZE 12
-
-struct iwl_rate_mcs_info {
- char mbps[IWL_MAX_MCS_DISPLAY_SIZE];
- char mcs[IWL_MAX_MCS_DISPLAY_SIZE];
-};
-
/**
* struct iwl_lq_sta_rs_fw - rate and related statistics for RS in FW
* @last_rate_n_flags: last rate reported by FW
@@ -454,4 +447,7 @@ void iwl_mvm_tlc_update_notif(struct iwl_mvm *mvm,
struct iwl_rx_cmd_buffer *rxb);
u16 rs_fw_get_max_amsdu_len(struct ieee80211_sta *sta);
+
+int iwl_rs_send_dhc(struct iwl_mvm *mvm, struct iwl_lq_sta_rs_fw *lq_sta,
+ u32 type, u32 data);
#endif /* __rs__ */
--
2.33.0
next prev parent reply other threads:[~2021-08-26 19:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-26 19:47 [PATCH v2 00/12] iwlwifi: updates intended for v5.15 2021-08-20 v2 Luca Coelho
2021-08-26 19:47 ` [PATCH v2 01/12] iwlwifi: mvm: add support for range request command version 13 Luca Coelho
2021-08-26 20:38 ` Luca Coelho
2021-08-26 19:47 ` [PATCH v2 02/12] iwlwifi: mvm: add support for responder config command version 9 Luca Coelho
2021-08-26 19:47 ` [PATCH v2 03/12] iwlwifi: move get pnvm file name to a separate function Luca Coelho
2021-08-26 19:47 ` [PATCH v2 04/12] iwlwifi: mvm: introduce iwl_stored_beacon_notif_v3 Luca Coelho
2021-08-26 19:47 ` [PATCH v2 05/12] iwlwifi: mvm: support broadcast TWT alone Luca Coelho
2021-08-26 19:47 ` [PATCH v2 06/12] iwlwifi: mvm: Fix scan channel flags settings Luca Coelho
2021-08-26 19:47 ` [PATCH v2 07/12] iwlwifi: mvm: don't use FW key ID in beacon protection Luca Coelho
2021-08-26 19:47 ` [PATCH v2 08/12] iwlwifi: export DHC framework and add first public entry, twt_setup Luca Coelho
2021-08-26 19:47 ` Luca Coelho [this message]
2021-08-26 19:47 ` [PATCH v2 10/12] iwlwifi: Add support for getting rf id with blank otp Luca Coelho
2021-10-22 6:25 ` Luca Coelho
2021-10-22 7:13 ` Luca Coelho
2021-10-22 7:41 ` Luca Coelho
2021-08-26 19:47 ` [PATCH v2 11/12] iwlwifi: Add support for more BZ HWs Luca Coelho
2021-08-26 19:47 ` [PATCH v2 12/12] iwlwifi: Start scratch debug register for Bz family Luca Coelho
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=iwlwifi.20210826224715.9cc9edb80dc4.I9d93ef704af34daed3c2075dfc3841ed03b9e590@changeid \
--to=luca@coelho.fi \
--cc=kvalo@codeaurora.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).