In multi-wiphy architecture where each radio is tied to a separate wiphy, a few radio configuration parameters and wiphy parameters are maintained as separate debugfs entries. So, the radio configuration parameters - 'fragmentation_threshold', 'rts_threshold', 'long_retry_limit' and 'short_retry_limit' and the wiphy parameters - 'airtime_flags', 'aql_enable', 'aql_pending', 'aql_threshold', 'aql_txq_limit', 'aqm', 'force_tx_status', 'ht40allow_map', 'hw_conf', 'hwflags', 'power', 'queues', 'rate_ctrl_alg', 'reset', 'total_ps_buffered', 'user_power' and 'wep_iv' are present in separate directories corresponding to the respective wiphy. So the debugfs directory structure is represented as: /sys |- kernel |- debug |- ieee80211 |- phy#0 |- airtime_flags |- aql_enable ... |- user_power |- wep_iv |- fragmentation_threshold |- rts_threshold |- long_retry_limit |- short_retry_limit |- phy#1 |- airtime_flags |- aql_enable ... |- user_power |- wep_iv |- fragmentation_threshold |- rts_threshold |- long_retry_limit |- short_retry_limit |- phy#2 |- airtime_flags |- aql_enable ... |- user_power |- wep_iv |- fragmentation_threshold |- rts_threshold |- long_retry_limit |- short_retry_limit In single-wiphy architecture, where a single wiphy can have multiple radios tied to it, radio configuration parameters and wiphy parameters are maintained similar to how it is done in multi-wiphy architecture, i.e., under phy#X. These can be considered as global wiphy configuration parameters. In case of wiphy parameters, these are tied to global data of the entire physical device and common to all radios irrespective of the architecture. But each radio can have different values for each radio configuration parameter. To address this, in addition to maintaining global wiphy configuration parameters in phy#X directory, create separate debugfs directories for each radio in a wiphy and within each directory, maintain parameters corresponding to that radio. So, the proposed debugfs directory structure can be represented as: /sys |- kernel |- debug |- ieee80211 |- phy#0 |- airtime_flags |- aql_enable ... |- user_power |- wep_iv |- fragmentation_threshold |- rts_threshold |- long_retry_limit |- short_retry_limit |- radio0 |- fragmentation_threshold |- rts_threshold |- long_retry_limit |- short_retry_limit |- radio1 |- fragmentation_threshold |- rts_threshold |- long_retry_limit |- short_retry_limit |- phy#1 |- airtime_flags |- aql_enable ... |- user_power |- wep_iv |- fragmentation_threshold |- rts_threshold |- long_retry_limit |- short_retry_limit |- radio0 |- fragmentation_threshold |- rts_threshold |- long_retry_limit |- short_retry_limit |- phy#2 |- airtime_flags |- aql_enable ... |- user_power |- wep_iv |- fragmentation_threshold |- rts_threshold |- long_retry_limit |- short_retry_limit |- radio0 |- fragmentation_threshold |- rts_threshold |- long_retry_limit |- short_retry_limit |- radio1 |- fragmentation_threshold |- rts_threshold |- long_retry_limit |- short_retry_limit |- radio2 |- fragmentation_threshold |- rts_threshold |- long_retry_limit |- short_retry_limit To do this, 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. diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 406626ff6cc8..ebf1ab99766b 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -5584,6 +5584,7 @@ struct wiphy_iftype_akm_suites { */ struct wiphy_radio_cfg { u32 rts_threshold; + struct dentry *radio_debugfsdir; }; /** Create separate directories representing each radio within phy#X directory during wiphy registration. diff --git a/net/wireless/core.c b/net/wireless/core.c index a7e2931ffb2e..46d9c881c7fc 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -1009,8 +1009,14 @@ int wiphy_register(struct wiphy *wiphy) * MIB default values. RTS threshold is disabled by * default with the special -1 value. */ - for (idx = 0; idx < wiphy->n_radio; idx++) + for (idx = 0; idx < wiphy->n_radio; idx++) { wiphy->radio_cfg[idx].rts_threshold = (u32)-1; + scnprintf(radio_name, sizeof(radio_name), "radio%d", + idx); + wiphy->radio_cfg[idx].radio_debugfsdir = + debugfs_create_dir(name, + rdev->wiphy.debugfsdir); + } } /* check and set up bitrates */ This will create separate directories within phyX directory like: # ls /sys/kernel/debug/ieee80211/phy0/radio radio0/ radio1/ radio2/ Whenever a wiphy configuration parameter is added as an entry to phyX directory, check if that applies on a per-radio basis and if it does, create its entry in radio directories too. This way radio-specific configuration parameters can be maintained along with global wiphy configuration parameters. Also, initialize the entries inside radio directories with value present in global wiphy configuration, because at the time of wiphy registration, all radios in wiphy will have the same' parameters configuration. With this change brought in, when user tries to modify the value of any of radio's configuration parameter, only that radio's parameter will change and the global wiphy parameter and other other radios' parameter values will remain unchanged. Also, when the user tries to write to global wiphy parameter, then the existing behavior will work, i.e., the global wiphy parameter will get changed, but in addition, that particular parameter of all radios in that wiphy will also get updated to the new value of global wiphy parameter. This ensures backward compatibility is maintained, i.e., the existing userspace will work alongside the per-radio parameters configuration implementation.