Commit e9dd2555 authored by Miri Korenblit's avatar Miri Korenblit Committed by Johannes Berg

wifi: iwlwifi: mvm: add a per-link debugfs

Add a per-link debugfs entry in iwlmvm level so we can read/write link
related parameters.
Do it by implementing the link_add_debugfs API introduced by mac80211.

Each entry will have a path like this:
.../netdev:wlan0/link-X/iwlmvm/<file_name>
for each link X.

For non-MLD vifs this callback is called when the original vif
debugfs dir is also created, so handle that case by not creating
the 'iwlmvm' directory again.

Note that we don't have to worry about the cleaning the iwlmvm/*
directory as it is already done by mac80211 when removing the link
(or netdev).
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231004123422.6a161f021ae8.Ic8f40f2b4682270c94036e3c11c3996ae34266fa@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent c36235ac
......@@ -761,3 +761,49 @@ void iwl_mvm_vif_dbgfs_rm_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
debugfs_remove(mvmvif->dbgfs_slink);
mvmvif->dbgfs_slink = NULL;
}
#define MVM_DEBUGFS_WRITE_LINK_FILE_OPS(name, bufsz) \
_MVM_DEBUGFS_WRITE_FILE_OPS(link_##name, bufsz, \
struct ieee80211_bss_conf)
#define MVM_DEBUGFS_READ_WRITE_LINK_FILE_OPS(name, bufsz) \
_MVM_DEBUGFS_READ_WRITE_FILE_OPS(link_##name, bufsz, \
struct ieee80211_bss_conf)
#define MVM_DEBUGFS_ADD_LINK_FILE(name, parent, mode) \
debugfs_create_file(#name, mode, parent, link_conf, \
&iwl_dbgfs_link_##name##_ops)
static void iwl_mvm_debugfs_add_link_files(struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf,
struct dentry *mvm_dir)
{
/* Add per-link files here*/
}
void iwl_mvm_link_add_debugfs(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf,
struct dentry *dir)
{
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
struct iwl_mvm *mvm = mvmvif->mvm;
unsigned int link_id = link_conf->link_id;
struct iwl_mvm_vif_link_info *link_info = mvmvif->link[link_id];
struct dentry *mvm_dir;
if (WARN_ON(!link_info) || !dir)
return;
if (dir == vif->debugfs_dir) {
WARN_ON(!mvmvif->dbgfs_dir);
mvm_dir = mvmvif->dbgfs_dir;
} else {
mvm_dir = debugfs_create_dir("iwlmvm", dir);
if (IS_ERR_OR_NULL(mvm_dir)) {
IWL_ERR(mvm, "Failed to create debugfs directory under %pd\n",
dir);
return;
}
}
iwl_mvm_debugfs_add_link_files(vif, link_conf, mvm_dir);
}
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2012-2014 Intel Corporation
* Copyright (C) 2013-2014 Intel Mobile Communications GmbH
*/
......
......@@ -1210,6 +1210,7 @@ const struct ieee80211_ops iwl_mvm_mld_hw_ops = {
#ifdef CONFIG_IWLWIFI_DEBUGFS
.vif_add_debugfs = iwl_mvm_vif_add_debugfs,
.link_add_debugfs = iwl_mvm_link_add_debugfs,
.link_sta_add_debugfs = iwl_mvm_link_sta_add_debugfs,
#endif
.set_hw_timestamp = iwl_mvm_set_hw_timestamp,
......
......@@ -2406,6 +2406,10 @@ void iwl_mvm_link_sta_add_debugfs(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_link_sta *link_sta,
struct dentry *dir);
void iwl_mvm_link_add_debugfs(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf,
struct dentry *dir);
#endif
/* new MLD related APIs */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment