Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wifi: cfg80211: Add debugfs support for multi-radio wiphy

In multi-radio wiphy architecture, where a single wiphy can have
multiple radios tied to it, radio specific configuration parameters
and global wiphy parameters are maintained for the entire physical
device and common to all radios. But, each radio in a wiphy can have
different values for each radio configuration parameter, like RTS
threshold. With the current debugfs directory structure, the values
of global wiphy configuration parameters can be viewed, but, values
of individual radio configuration parameters cannot be viewed, as
radio specific configuration parameters are not maintained, separately.

To address this, in addition to maintaining global wiphy configuration
parameters common to all radios, create separate debugfs directories
for each radio in a wiphy to maintain parameters corresponding to that
radio in this directory.

In implementation, maintain a dentry structure in wiphy_radio_cfg, a
structure containing radio configurations of a wiphy. This struct is
maintained to denote per-radio configurations of a wiphy. Create
separate directories representing each radio within phy#X directory in
debugfs during wiphy registration.

Sample directory structure with this change:
ls /sys/kernel/debug/ieee80211/phy0/radio
radio0/ radio1/ radio2/

Signed-off-by: Roopni Devanathan <quic_rdevanat@quicinc.com>
Link: https://patch.msgid.link/20251024044649.483557-2-quic_rdevanat@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Roopni Devanathan and committed by
Johannes Berg
7cc986c0 cc18fffa

+19
+4
include/net/cfg80211.h
··· 5684 5684 * 5685 5685 * @rts_threshold: RTS threshold (dot11RTSThreshold); 5686 5686 * -1 (default) = RTS/CTS disabled 5687 + * @radio_debugfsdir: Pointer to debugfs directory containing the radio- 5688 + * specific parameters. 5689 + * NULL (default) = Debugfs directory not created 5687 5690 */ 5688 5691 struct wiphy_radio_cfg { 5689 5692 u32 rts_threshold; 5693 + struct dentry *radio_debugfsdir; 5690 5694 }; 5691 5695 5692 5696 /**
+15
net/wireless/core.c
··· 34 34 /* name for sysfs, %d is appended */ 35 35 #define PHY_NAME "phy" 36 36 37 + /* maximum length of radio debugfs directory name */ 38 + #define RADIO_DEBUGFSDIR_MAX_LEN 8 39 + 37 40 MODULE_AUTHOR("Johannes Berg"); 38 41 MODULE_LICENSE("GPL"); 39 42 MODULE_DESCRIPTION("wireless configuration support"); ··· 1045 1042 /* add to debugfs */ 1046 1043 rdev->wiphy.debugfsdir = debugfs_create_dir(wiphy_name(&rdev->wiphy), 1047 1044 ieee80211_debugfs_dir); 1045 + if (wiphy->n_radio > 0) { 1046 + int idx; 1047 + char radio_name[RADIO_DEBUGFSDIR_MAX_LEN]; 1048 + 1049 + for (idx = 0; idx < wiphy->n_radio; idx++) { 1050 + scnprintf(radio_name, sizeof(radio_name), "radio%d", 1051 + idx); 1052 + wiphy->radio_cfg[idx].radio_debugfsdir = 1053 + debugfs_create_dir(radio_name, 1054 + rdev->wiphy.debugfsdir); 1055 + } 1056 + } 1048 1057 1049 1058 cfg80211_debugfs_rdev_add(rdev); 1050 1059 nl80211_notify_wiphy(rdev, NL80211_CMD_NEW_WIPHY);