linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] wifi: cfg80211/mac80211: Set/get wiphy parameters on per-radio basis
@ 2025-01-24 17:17 Roopni Devanathan
  2025-01-24 17:17 ` [PATCH v2 1/5] wifi: cfg80211: Add Support to Set RTS Threshold for each Radio Roopni Devanathan
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Roopni Devanathan @ 2025-01-24 17:17 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless, Roopni Devanathan

Currently wiphy level configurations like RTS threshold, TX power etc.
lacks radio level get/set support and same value is applied to all radios
of wiphy. Add support to parse radio id attribute and use the same to
apply the configuration to corresponding radio of a multi radio wiphy.

This design will not disturb the global wiphy configuration. If radio id is
not passed from userspace, then the existing design of setting attribute to
all the radios will hold good.

Also add support to get the radio specific attributes in a multi-radio
wiphy from userspace.

The attributes that can be handled for each radio are:
NL80211_ATTR_WIPHY_FREQ
NL80211_ATTR_WIPHY_ANTENNA_TX
NL80211_ATTR_WIPHY_ANTENNA_RX
NL80211_ATTR_WIPHY_RETRY_SHORT
NL80211_ATTR_WIPHY_RETRY_LONG
NL80211_ATTR_WIPHY_FRAG_THRESHOLD
NL80211_ATTR_WIPHY_RTS_THRESHOLD
NL80211_ATTR_WIPHY_COVERAGE_CLASS
NL80211_ATTR_WIPHY_DYN_AC

With this design, the new userspace designed to set/get per-radio
parameters can work with both traditional and multi-radio wiphys.

v2:
 - Rebase on ToT. No code change.

Rameshkumar Sundaram (2):
  wifi: cfg80211: set tx power per radio in a wiphy
  wifi: mac80211: set tx power per radio in a wiphy

Roopni Devanathan (3):
  wifi: cfg80211: Add Support to Set RTS Threshold for each Radio
  wifi: cfg80211: Report per-radio RTS threshold to userspace
  wifi: mac80211: Set RTS threshold on per-radio basis

 drivers/net/wireless/ath/ar5523/ar5523.c      |  2 +-
 drivers/net/wireless/ath/ath10k/mac.c         |  2 +-
 drivers/net/wireless/ath/ath11k/mac.c         |  2 +-
 drivers/net/wireless/ath/ath12k/mac.c         |  2 +-
 drivers/net/wireless/ath/ath6kl/cfg80211.c    |  3 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |  2 +-
 drivers/net/wireless/ath/wcn36xx/main.c       |  2 +-
 drivers/net/wireless/ath/wil6210/cfg80211.c   |  2 +-
 .../broadcom/brcm80211/brcmfmac/cfg80211.c    |  4 +-
 .../net/wireless/intel/iwlwifi/mvm/mac80211.c |  2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  2 +-
 .../net/wireless/marvell/mwifiex/cfg80211.c   |  4 +-
 drivers/net/wireless/marvell/mwl8k.c          |  2 +-
 .../net/wireless/mediatek/mt76/mt7615/main.c  |  2 +-
 drivers/net/wireless/mediatek/mt76/mt76x02.h  |  2 +-
 .../net/wireless/mediatek/mt76/mt76x02_util.c |  2 +-
 .../net/wireless/mediatek/mt76/mt7915/main.c  |  2 +-
 .../net/wireless/mediatek/mt76/mt7921/main.c  |  2 +-
 .../net/wireless/mediatek/mt76/mt7925/main.c  |  2 +-
 .../net/wireless/mediatek/mt76/mt7996/main.c  |  2 +-
 drivers/net/wireless/mediatek/mt7601u/main.c  |  2 +-
 .../wireless/microchip/wilc1000/cfg80211.c    |  4 +-
 drivers/net/wireless/purelifi/plfxlc/mac.c    |  2 +-
 .../net/wireless/quantenna/qtnfmac/cfg80211.c |  4 +-
 .../net/wireless/ralink/rt2x00/rt2800lib.c    |  2 +-
 .../net/wireless/ralink/rt2x00/rt2800lib.h    |  2 +-
 drivers/net/wireless/realtek/rtl8xxxu/core.c  |  2 +-
 drivers/net/wireless/realtek/rtw88/mac80211.c |  2 +-
 drivers/net/wireless/realtek/rtw89/mac80211.c |  2 +-
 drivers/net/wireless/rsi/rsi_91x_mac80211.c   |  1 +
 drivers/net/wireless/silabs/wfx/sta.c         |  2 +-
 drivers/net/wireless/silabs/wfx/sta.h         |  2 +-
 drivers/net/wireless/st/cw1200/sta.c          |  2 +-
 drivers/net/wireless/st/cw1200/sta.h          |  2 +-
 drivers/net/wireless/ti/wl1251/main.c         |  2 +-
 drivers/net/wireless/ti/wlcore/main.c         |  2 +-
 drivers/net/wireless/virtual/mac80211_hwsim.c |  3 +-
 .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c |  4 +-
 include/net/cfg80211.h                        | 22 +++++++-
 include/net/mac80211.h                        |  2 +-
 include/uapi/linux/nl80211.h                  |  9 +++
 net/mac80211/cfg.c                            | 25 ++++++++-
 net/mac80211/driver-ops.h                     |  6 +-
 net/mac80211/trace.h                          | 24 +++++++-
 net/mac80211/util.c                           |  7 ++-
 net/wireless/core.c                           | 18 ++++++
 net/wireless/nl80211.c                        | 55 +++++++++++++++----
 net/wireless/rdev-ops.h                       | 12 ++--
 net/wireless/trace.h                          | 16 ++++--
 net/wireless/wext-compat.c                    | 11 ++--
 50 files changed, 213 insertions(+), 81 deletions(-)


base-commit: e7ef944b3e2c31b608800925e784f67596375770
-- 
2.17.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/5] wifi: cfg80211: Add Support to Set RTS Threshold for each Radio
  2025-01-24 17:17 [PATCH v2 0/5] wifi: cfg80211/mac80211: Set/get wiphy parameters on per-radio basis Roopni Devanathan
@ 2025-01-24 17:17 ` Roopni Devanathan
  2025-01-25 15:40   ` kernel test robot
  2025-01-24 17:17 ` [PATCH v2 2/5] wifi: cfg80211: Report per-radio RTS threshold to userspace Roopni Devanathan
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Roopni Devanathan @ 2025-01-24 17:17 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless, Roopni Devanathan

Currently, setting RTS threshold is based on per-phy basis, i.e., all the
radios present in a wiphy will take RTS threshold value to be the one sent
from userspace. But each radio in a multi-radio wiphy can have different
RTS threshold requirements.

To extend support to set RTS threshold for each radio, get the radio for
which RTS threshold needs to be changed from the user. Add a new attribute
in NL - NL80211_ATTR_WIPHY_RADIO_INDEX, to identify the radio of interest.
Create a new structure - wiphy_radio_cfg and add rts_threshold in it as a
u32 value to store RTS threshold of each radio in a wiphy and allocate
memory for it during wiphy register based on the wiphy.n_radio updated by
drivers. Pass radio id received from the user to mac80211 drivers along
with its corresponding RTS threshold.

Signed-off-by: Roopni Devanathan <quic_rdevanat@quicinc.com>
---
 drivers/net/wireless/ath/ath6kl/cfg80211.c    |  2 +-
 drivers/net/wireless/ath/wil6210/cfg80211.c   |  2 +-
 .../broadcom/brcm80211/brcmfmac/cfg80211.c    |  2 +-
 .../net/wireless/marvell/mwifiex/cfg80211.c   |  2 +-
 .../wireless/microchip/wilc1000/cfg80211.c    |  2 +-
 .../net/wireless/quantenna/qtnfmac/cfg80211.c |  2 +-
 .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c |  2 +-
 include/net/cfg80211.h                        | 20 +++++++-
 include/uapi/linux/nl80211.h                  |  8 ++++
 net/mac80211/cfg.c                            |  2 +-
 net/wireless/core.c                           | 18 ++++++++
 net/wireless/nl80211.c                        | 46 +++++++++++++++----
 net/wireless/rdev-ops.h                       |  6 +--
 net/wireless/trace.h                          |  5 +-
 net/wireless/wext-compat.c                    |  8 ++--
 15 files changed, 102 insertions(+), 25 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 72ce321f2a77..120dbd66ea11 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -1376,7 +1376,7 @@ void ath6kl_cfg80211_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid,
 				     GFP_KERNEL);
 }
 
-static int ath6kl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
+static int ath6kl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 changed)
 {
 	struct ath6kl *ar = (struct ath6kl *)wiphy_priv(wiphy);
 	struct ath6kl_vif *vif;
diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c
index a1a0a9223e74..fc6e33cb3d48 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -1408,7 +1408,7 @@ static int wil_cfg80211_disconnect(struct wiphy *wiphy,
 	return rc;
 }
 
-static int wil_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
+static int wil_cfg80211_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 changed)
 {
 	struct wil6210_priv *wil = wiphy_to_wil(wiphy);
 	int rc;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 4b70845e1a26..418b9dadb039 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -1623,7 +1623,7 @@ static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l)
 	return err;
 }
 
-static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
+static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 changed)
 {
 	struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
 	struct net_device *ndev = cfg_to_ndev(cfg);
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index a099fdaafa45..8f1929ee2a92 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -737,7 +737,7 @@ mwifiex_set_rts(struct mwifiex_private *priv, u32 rts_thr)
  * Fragmentation threshold of the driver.
  */
 static int
-mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
+mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 changed)
 {
 	struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy);
 	struct mwifiex_private *priv;
diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
index e7aa0f991923..2de0834d76cd 100644
--- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c
+++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
@@ -800,7 +800,7 @@ static int change_bss(struct wiphy *wiphy, struct net_device *dev,
 	return 0;
 }
 
-static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
+static int set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 changed)
 {
 	int ret = -EINVAL;
 	struct cfg_param_attr cfg_param_val;
diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
index 0b2282528342..e4ba386f6265 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
@@ -370,7 +370,7 @@ static int qtnf_stop_ap(struct wiphy *wiphy, struct net_device *dev,
 	return ret;
 }
 
-static int qtnf_set_wiphy_params(struct wiphy *wiphy, u32 changed)
+static int qtnf_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 changed)
 {
 	struct qtnf_wmac *mac = wiphy_priv(wiphy);
 	struct qtnf_vif *vif;
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 7fcc46a0bb48..c7458bf9a7f1 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -1298,7 +1298,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
 	return ret;
 }
 
-static int cfg80211_rtw_set_wiphy_params(struct wiphy *wiphy, u32 changed)
+static int cfg80211_rtw_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 changed)
 {
 	return 0;
 }
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 363d7dd2255a..9cbce47fcea6 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4750,7 +4750,7 @@ struct cfg80211_ops {
 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
 				  int rate[NUM_NL80211_BANDS]);
 
-	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
+	int	(*set_wiphy_params)(struct wiphy *wiphy, u8 radio_id, u32 changed);
 
 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
 				enum nl80211_tx_power_setting type, int mbm);
@@ -5441,6 +5441,18 @@ struct wiphy_iftype_akm_suites {
 	int n_akm_suites;
 };
 
+/**
+ * struct wiphy_radio_cfg - physical radio config of a wiphy
+ * This structure describes the configurations of a physical radio in a
+ * wiphy. It is used to denote per-radio attributes belonging to a wiphy.
+ *
+ * @rts_threshold: RTS threshold (dot11RTSThreshold);
+ *	-1 (default) = RTS/CTS disabled
+ */
+struct wiphy_radio_cfg {
+	u32 rts_threshold;
+};
+
 /**
  * struct wiphy_radio_freq_range - wiphy frequency range
  * @start_freq:  start range edge frequency (kHz)
@@ -5698,6 +5710,10 @@ struct wiphy_radio {
  *
  * @radio: radios belonging to this wiphy
  * @n_radio: number of radios
+ *
+ * @radio_cfg: configuration of radios belonging to a muli-radio wiphy. This struct
+ *	contains a list of all radio specific attributes and should be used only for
+ *	multi-radio wiphy.
  */
 struct wiphy {
 	struct mutex mtx;
@@ -5785,6 +5801,8 @@ struct wiphy {
 	void (*reg_notifier)(struct wiphy *wiphy,
 			     struct regulatory_request *request);
 
+	struct wiphy_radio_cfg *radio_cfg;
+
 	/* fields below are read-only, assigned by cfg80211 */
 
 	const struct ieee80211_regdomain __rcu *regd;
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index f6c1b181c886..5e7dca7c6083 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2893,6 +2893,11 @@ enum nl80211_commands {
  * @NL80211_ATTR_EPCS: Flag attribute indicating that EPCS is enabled for a
  *	station interface.
  *
+ * @NL80211_ATTR_WIPHY_RADIO_INDEX: Integer attribute denoting the index of
+ *	the radio in interest. Internally a value of 0xff is used to indicate
+ *	this attribute is not present, and hence any associated attributes are
+ *	deemed to be applicable to all radios
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3448,6 +3453,8 @@ enum nl80211_attrs {
 	NL80211_ATTR_MLO_RECONF_REM_LINKS,
 	NL80211_ATTR_EPCS,
 
+	NL80211_ATTR_WIPHY_RADIO_INDEX,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
@@ -3490,6 +3497,7 @@ enum nl80211_attrs {
 #define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
 
 #define NL80211_WIPHY_NAME_MAXLEN		64
+#define NL80211_WIPHY_RADIO_ID_MAX		0xff
 
 #define NL80211_MAX_SUPP_RATES			32
 #define NL80211_MAX_SUPP_SELECTORS		128
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 9351c64608a9..ac28800fcaee 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3009,7 +3009,7 @@ static int ieee80211_set_mcast_rate(struct wiphy *wiphy, struct net_device *dev,
 	return 0;
 }
 
-static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
+static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 changed)
 {
 	struct ieee80211_local *local = wiphy_priv(wiphy);
 	int err;
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 70857018f020..3f4c9edc2bc8 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -1077,6 +1077,23 @@ int wiphy_register(struct wiphy *wiphy)
 		return res;
 	}
 
+	/* Allocate radio configuration space for multi-radio wiphy.
+	 */
+	if (wiphy->n_radio) {
+		int idx;
+
+		wiphy->radio_cfg = kcalloc(wiphy->n_radio, sizeof(*wiphy->radio_cfg),
+					   GFP_KERNEL);
+		if (!wiphy->radio_cfg)
+			return -ENOMEM;
+		/*
+		 * Initialize wiphy radio parameters to IEEE 802.11 MIB default values.
+		 * RTS threshold is disabled by default with the special -1 value.
+		 */
+		for (idx = 0; idx < wiphy->n_radio; idx++)
+			wiphy->radio_cfg[idx].rts_threshold = (u32)-1;
+	}
+
 	return 0;
 }
 EXPORT_SYMBOL(wiphy_register);
@@ -1187,6 +1204,7 @@ void wiphy_unregister(struct wiphy *wiphy)
 	cfg80211_rdev_free_wowlan(rdev);
 	cfg80211_free_coalesce(rdev->coalesce);
 	rdev->coalesce = NULL;
+	kfree(wiphy->radio_cfg);
 }
 EXPORT_SYMBOL(wiphy_unregister);
 
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d7d3da0f6833..0cf6533a7ecb 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -850,6 +850,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
 				       NL80211_MAX_SUPP_SELECTORS),
 	[NL80211_ATTR_MLO_RECONF_REM_LINKS] = { .type = NLA_U16 },
 	[NL80211_ATTR_EPCS] = { .type = NLA_FLAG },
+	[NL80211_ATTR_WIPHY_RADIO_INDEX] = { .type = NLA_U8 },
 };
 
 /* policy for the key attributes */
@@ -3607,7 +3608,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
 	int result = 0, rem_txq_params = 0;
 	struct nlattr *nl_txq_params;
 	u32 changed;
-	u8 retry_short = 0, retry_long = 0;
+	u8 retry_short = 0, retry_long = 0, radio_id = NL80211_WIPHY_RADIO_ID_MAX;
 	u32 frag_threshold = 0, rts_threshold = 0;
 	u8 coverage_class = 0;
 	u32 txq_limit = 0, txq_memory_limit = 0, txq_quantum = 0;
@@ -3661,6 +3662,16 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
 	if (result)
 		return result;
 
+	if (info->attrs[NL80211_ATTR_WIPHY_RADIO_INDEX]) {
+		/* Radio idx is not expected for non-multi radio wiphy */
+		if (!rdev->wiphy.n_radio)
+			return -EINVAL;
+
+		radio_id = nla_get_u8(info->attrs[NL80211_ATTR_WIPHY_RADIO_INDEX]);
+		if (radio_id > rdev->wiphy.n_radio)
+			return -EINVAL;
+	}
+
 	if (info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS]) {
 		struct ieee80211_txq_params txq_params;
 		struct nlattr *tb[NL80211_TXQ_ATTR_MAX + 1];
@@ -3869,8 +3880,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
 
 	if (changed) {
 		u8 old_retry_short, old_retry_long;
-		u32 old_frag_threshold, old_rts_threshold;
-		u8 old_coverage_class;
+		u32 old_frag_threshold, old_rts_threshold[NL80211_WIPHY_RADIO_ID_MAX];
+		u8 old_coverage_class, i;
 		u32 old_txq_limit, old_txq_memory_limit, old_txq_quantum;
 
 		if (!rdev->ops->set_wiphy_params)
@@ -3879,7 +3890,13 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
 		old_retry_short = rdev->wiphy.retry_short;
 		old_retry_long = rdev->wiphy.retry_long;
 		old_frag_threshold = rdev->wiphy.frag_threshold;
-		old_rts_threshold = rdev->wiphy.rts_threshold;
+		if (radio_id >= rdev->wiphy.n_radio) {
+			old_rts_threshold[0] = rdev->wiphy.rts_threshold;
+			for (i = 0; i < rdev->wiphy.n_radio; i++)
+				old_rts_threshold[i] = rdev->wiphy.radio_cfg[i].rts_threshold;
+		} else {
+			old_rts_threshold[radio_id] = rdev->wiphy.radio_cfg[radio_id].rts_threshold;
+		}
 		old_coverage_class = rdev->wiphy.coverage_class;
 		old_txq_limit = rdev->wiphy.txq_limit;
 		old_txq_memory_limit = rdev->wiphy.txq_memory_limit;
@@ -3891,8 +3908,15 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
 			rdev->wiphy.retry_long = retry_long;
 		if (changed & WIPHY_PARAM_FRAG_THRESHOLD)
 			rdev->wiphy.frag_threshold = frag_threshold;
-		if (changed & WIPHY_PARAM_RTS_THRESHOLD)
-			rdev->wiphy.rts_threshold = rts_threshold;
+		if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
+			if (radio_id >= rdev->wiphy.n_radio) {
+				rdev->wiphy.rts_threshold = rts_threshold;
+				for (i = 0; i < rdev->wiphy.n_radio; i++)
+					rdev->wiphy.radio_cfg[i].rts_threshold = rts_threshold;
+			} else {
+				rdev->wiphy.radio_cfg[radio_id].rts_threshold =	rts_threshold;
+			}
+		}
 		if (changed & WIPHY_PARAM_COVERAGE_CLASS)
 			rdev->wiphy.coverage_class = coverage_class;
 		if (changed & WIPHY_PARAM_TXQ_LIMIT)
@@ -3902,12 +3926,18 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
 		if (changed & WIPHY_PARAM_TXQ_QUANTUM)
 			rdev->wiphy.txq_quantum = txq_quantum;
 
-		result = rdev_set_wiphy_params(rdev, changed);
+		result = rdev_set_wiphy_params(rdev, radio_id, changed);
 		if (result) {
 			rdev->wiphy.retry_short = old_retry_short;
 			rdev->wiphy.retry_long = old_retry_long;
 			rdev->wiphy.frag_threshold = old_frag_threshold;
-			rdev->wiphy.rts_threshold = old_rts_threshold;
+			if (radio_id >= rdev->wiphy.n_radio) {
+				rdev->wiphy.rts_threshold = old_rts_threshold[0];
+				for (i = 0; i < rdev->wiphy.n_radio; i++)
+					rdev->wiphy.radio_cfg[i].rts_threshold = old_rts_threshold[i];
+			} else {
+				rdev->wiphy.radio_cfg[radio_id].rts_threshold = old_rts_threshold[radio_id];
+			}
 			rdev->wiphy.coverage_class = old_coverage_class;
 			rdev->wiphy.txq_limit = old_txq_limit;
 			rdev->wiphy.txq_memory_limit = old_txq_memory_limit;
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index 759da1623342..0b4185013fb2 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -577,13 +577,13 @@ static inline int rdev_leave_ibss(struct cfg80211_registered_device *rdev,
 }
 
 static inline int
-rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed)
+rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u8 radio_id, u32 changed)
 {
 	int ret = -EOPNOTSUPP;
 
-	trace_rdev_set_wiphy_params(&rdev->wiphy, changed);
+	trace_rdev_set_wiphy_params(&rdev->wiphy, radio_id, changed);
 	if (rdev->ops->set_wiphy_params)
-		ret = rdev->ops->set_wiphy_params(&rdev->wiphy, changed);
+		ret = rdev->ops->set_wiphy_params(&rdev->wiphy, radio_id, changed);
 	trace_rdev_return_int(&rdev->wiphy, ret);
 	return ret;
 }
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 4f0abd5d49df..5fd600f54e0a 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -1676,10 +1676,11 @@ TRACE_EVENT(rdev_join_ocb,
 );
 
 TRACE_EVENT(rdev_set_wiphy_params,
-	TP_PROTO(struct wiphy *wiphy, u32 changed),
-	TP_ARGS(wiphy, changed),
+	TP_PROTO(struct wiphy *wiphy, u8 radio_id, u32 changed),
+	TP_ARGS(wiphy, radio_id, changed),
 	TP_STRUCT__entry(
 		WIPHY_ENTRY
+		__field(u8, radio_id)
 		__field(u32, changed)
 	),
 	TP_fast_assign(
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index a74b1afc594e..fd4a4112610e 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -263,7 +263,8 @@ int cfg80211_wext_siwrts(struct net_device *dev,
 	else
 		wdev->wiphy->rts_threshold = rts->value;
 
-	err = rdev_set_wiphy_params(rdev, WIPHY_PARAM_RTS_THRESHOLD);
+	err = rdev_set_wiphy_params(rdev, NL80211_WIPHY_RADIO_ID_MAX,
+				    WIPHY_PARAM_RTS_THRESHOLD);
 	if (err)
 		wdev->wiphy->rts_threshold = orts;
 	return err;
@@ -304,7 +305,8 @@ int cfg80211_wext_siwfrag(struct net_device *dev,
 		wdev->wiphy->frag_threshold = frag->value & ~0x1;
 	}
 
-	err = rdev_set_wiphy_params(rdev, WIPHY_PARAM_FRAG_THRESHOLD);
+	err = rdev_set_wiphy_params(rdev, NL80211_WIPHY_RADIO_ID_MAX,
+				    WIPHY_PARAM_FRAG_THRESHOLD);
 	if (err)
 		wdev->wiphy->frag_threshold = ofrag;
 	return err;
@@ -355,7 +357,7 @@ static int cfg80211_wext_siwretry(struct net_device *dev,
 		changed |= WIPHY_PARAM_RETRY_SHORT;
 	}
 
-	err = rdev_set_wiphy_params(rdev, changed);
+	err = rdev_set_wiphy_params(rdev, NL80211_WIPHY_RADIO_ID_MAX, changed);
 	if (err) {
 		wdev->wiphy->retry_short = oshort;
 		wdev->wiphy->retry_long = olong;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/5] wifi: cfg80211: Report per-radio RTS threshold to userspace
  2025-01-24 17:17 [PATCH v2 0/5] wifi: cfg80211/mac80211: Set/get wiphy parameters on per-radio basis Roopni Devanathan
  2025-01-24 17:17 ` [PATCH v2 1/5] wifi: cfg80211: Add Support to Set RTS Threshold for each Radio Roopni Devanathan
@ 2025-01-24 17:17 ` Roopni Devanathan
  2025-01-24 17:17 ` [PATCH v2 3/5] wifi: mac80211: Set RTS threshold on per-radio basis Roopni Devanathan
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Roopni Devanathan @ 2025-01-24 17:17 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless, Roopni Devanathan

In case of multi-radio wiphys, with per-radio RTS threshold brought
into use, RTS threshold for each radio in a wiphy can be recorded in
wiphy parameter - wiphy_radio_cfg, as an array. Add a new attribute -
NL80211_WIPHY_RADIO_ATTR_RTS_THRESHOLD in nested parameter -
NL80211_ATTR_WIPHY_RADIOS. When a request for getting RTS threshold
for a particular radio is received, parse the radio id and get the
required data. Add this data to the newly added nested attribute
NL80211_WIPHY_RADIO_ATTR_RTS_THRESHOLD. Add support to report this
data to userspace.

Signed-off-by: Roopni Devanathan <quic_rdevanat@quicinc.com>
---
 include/uapi/linux/nl80211.h | 1 +
 net/wireless/nl80211.c       | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 5e7dca7c6083..a140e2f2f7ee 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -8087,6 +8087,7 @@ enum nl80211_wiphy_radio_attrs {
 	NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE,
 	NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATION,
 	NL80211_WIPHY_RADIO_ATTR_ANTENNA_MASK,
+	NL80211_WIPHY_RADIO_ATTR_RTS_THRESHOLD,
 
 	/* keep last */
 	__NL80211_WIPHY_RADIO_ATTR_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 0cf6533a7ecb..e2e70250527e 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2439,6 +2439,7 @@ static int nl80211_put_mbssid_support(struct wiphy *wiphy, struct sk_buff *msg)
 static int nl80211_put_radio(struct wiphy *wiphy, struct sk_buff *msg, int idx)
 {
 	const struct wiphy_radio *r = &wiphy->radio[idx];
+	const struct wiphy_radio_cfg *rcfg = &wiphy->radio_cfg[idx];
 	struct nlattr *radio, *freq;
 	int i;
 
@@ -2449,6 +2450,9 @@ static int nl80211_put_radio(struct wiphy *wiphy, struct sk_buff *msg, int idx)
 	if (nla_put_u32(msg, NL80211_WIPHY_RADIO_ATTR_INDEX, idx))
 		goto nla_put_failure;
 
+	if (nla_put_u32(msg, NL80211_WIPHY_RADIO_ATTR_RTS_THRESHOLD, rcfg->rts_threshold))
+		goto nla_put_failure;
+
 	if (r->antenna_mask &&
 	    nla_put_u32(msg, NL80211_WIPHY_RADIO_ATTR_ANTENNA_MASK,
 			r->antenna_mask))
@@ -3231,7 +3235,8 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb)
 						 skb,
 						 NETLINK_CB(cb->skb).portid,
 						 cb->nlh->nlmsg_seq,
-						 NLM_F_MULTI, state);
+						 NLM_F_MULTI,
+						 state);
 			if (ret < 0) {
 				/*
 				 * If sending the wiphy data didn't fit (ENOBUFS
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/5] wifi: mac80211: Set RTS threshold on per-radio basis
  2025-01-24 17:17 [PATCH v2 0/5] wifi: cfg80211/mac80211: Set/get wiphy parameters on per-radio basis Roopni Devanathan
  2025-01-24 17:17 ` [PATCH v2 1/5] wifi: cfg80211: Add Support to Set RTS Threshold for each Radio Roopni Devanathan
  2025-01-24 17:17 ` [PATCH v2 2/5] wifi: cfg80211: Report per-radio RTS threshold to userspace Roopni Devanathan
@ 2025-01-24 17:17 ` Roopni Devanathan
  2025-01-25 11:49   ` kernel test robot
  2025-01-24 17:17 ` [PATCH v2 4/5] wifi: cfg80211: set tx power per radio in a wiphy Roopni Devanathan
  2025-01-24 17:17 ` [PATCH v2 5/5] wifi: mac80211: " Roopni Devanathan
  4 siblings, 1 reply; 8+ messages in thread
From: Roopni Devanathan @ 2025-01-24 17:17 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless, Roopni Devanathan

Add support to get the radio for which RTS threshold needs to be changed
from userspace. Pass on this radio index to underlying drivers as an
additional argument.

A value of NL80211_WIPHY_RADIO_ID_MAX(255) indicates radio index is not
mentioned and the configuration applies to all radio(s) of the wiphy.

Signed-off-by: Roopni Devanathan <quic_rdevanat@quicinc.com>
---
 drivers/net/wireless/ath/ar5523/ar5523.c      |  2 +-
 drivers/net/wireless/ath/ath10k/mac.c         |  2 +-
 drivers/net/wireless/ath/ath11k/mac.c         |  2 +-
 drivers/net/wireless/ath/ath12k/mac.c         |  2 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |  2 +-
 drivers/net/wireless/ath/wcn36xx/main.c       |  2 +-
 .../net/wireless/intel/iwlwifi/mvm/mac80211.c |  2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  2 +-
 drivers/net/wireless/marvell/mwl8k.c          |  2 +-
 .../net/wireless/mediatek/mt76/mt7615/main.c  |  2 +-
 drivers/net/wireless/mediatek/mt76/mt76x02.h  |  2 +-
 .../net/wireless/mediatek/mt76/mt76x02_util.c |  2 +-
 .../net/wireless/mediatek/mt76/mt7915/main.c  |  2 +-
 .../net/wireless/mediatek/mt76/mt7921/main.c  |  2 +-
 .../net/wireless/mediatek/mt76/mt7925/main.c  |  2 +-
 .../net/wireless/mediatek/mt76/mt7996/main.c  |  2 +-
 drivers/net/wireless/mediatek/mt7601u/main.c  |  2 +-
 drivers/net/wireless/purelifi/plfxlc/mac.c    |  2 +-
 .../net/wireless/ralink/rt2x00/rt2800lib.c    |  2 +-
 .../net/wireless/ralink/rt2x00/rt2800lib.h    |  2 +-
 drivers/net/wireless/realtek/rtl8xxxu/core.c  |  2 +-
 drivers/net/wireless/realtek/rtw88/mac80211.c |  2 +-
 drivers/net/wireless/realtek/rtw89/mac80211.c |  2 +-
 drivers/net/wireless/rsi/rsi_91x_mac80211.c   |  1 +
 drivers/net/wireless/silabs/wfx/sta.c         |  2 +-
 drivers/net/wireless/silabs/wfx/sta.h         |  2 +-
 drivers/net/wireless/st/cw1200/sta.c          |  2 +-
 drivers/net/wireless/st/cw1200/sta.h          |  2 +-
 drivers/net/wireless/ti/wl1251/main.c         |  2 +-
 drivers/net/wireless/ti/wlcore/main.c         |  2 +-
 drivers/net/wireless/virtual/mac80211_hwsim.c |  3 ++-
 include/net/mac80211.h                        |  2 +-
 net/mac80211/cfg.c                            |  8 ++++++-
 net/mac80211/driver-ops.h                     |  6 ++---
 net/mac80211/trace.h                          | 24 ++++++++++++++++---
 net/mac80211/util.c                           |  7 +++++-
 36 files changed, 70 insertions(+), 39 deletions(-)

diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c
index 156f3650c006..ad5dcc703370 100644
--- a/drivers/net/wireless/ath/ar5523/ar5523.c
+++ b/drivers/net/wireless/ath/ar5523/ar5523.c
@@ -1083,7 +1083,7 @@ static void ar5523_stop(struct ieee80211_hw *hw, bool suspend)
 	mutex_unlock(&ar->mutex);
 }
 
-static int ar5523_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int ar5523_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	struct ar5523 *ar = hw->priv;
 	int ret;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index c61b95a928da..4aac40ade257 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -8018,7 +8018,7 @@ static int ath10k_cancel_remain_on_channel(struct ieee80211_hw *hw,
  * in ath10k, but device-specific in mac80211.
  */
 
-static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	struct ath10k *ar = hw->priv;
 	struct ath10k_vif *arvif;
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 1556392f7ad4..225f32211b84 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -8122,7 +8122,7 @@ ath11k_set_vdev_param_to_all_vifs(struct ath11k *ar, int param, u32 value)
 /* mac80211 stores device specific RTS/Fragmentation threshold value,
  * this is set interface specific to firmware from ath11k driver
  */
-static int ath11k_mac_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int ath11k_mac_op_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	struct ath11k *ar = hw->priv;
 	int param_id = WMI_VDEV_PARAM_RTS_THRESHOLD;
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 2d062b5904a8..fa6f0e6555bf 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -9380,7 +9380,7 @@ ath12k_set_vdev_param_to_all_vifs(struct ath12k *ar, int param, u32 value)
 /* mac80211 stores device specific RTS/Fragmentation threshold value,
  * this is set interface specific to firmware from ath12k driver
  */
-static int ath12k_mac_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int ath12k_mac_op_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	struct ath12k_hw *ah = ath12k_hw_to_ah(hw);
 	struct ath12k *ar;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 57094bd45d98..88bbb2fec837 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1737,7 +1737,7 @@ static void ath9k_htc_sw_scan_complete(struct ieee80211_hw *hw,
 	mutex_unlock(&priv->mutex);
 }
 
-static int ath9k_htc_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int ath9k_htc_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	return 0;
 }
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index 94d08d6ae1a3..d7925d070e34 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -965,7 +965,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 }
 
 /* this is required when using IEEE80211_HW_HAS_RATE_CONTROL */
-static int wcn36xx_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int wcn36xx_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	struct wcn36xx *wcn = hw->priv;
 	wcn36xx_dbg(WCN36XX_DBG_MAC, "mac set RTS threshold %d\n", value);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index af6644b7e95f..c7923412e843 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -4241,7 +4241,7 @@ int iwl_mvm_mac_sta_state_common(struct ieee80211_hw *hw,
 	return ret;
 }
 
-int iwl_mvm_mac_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+int iwl_mvm_mac_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index ee769da72e68..ffb233a8a6cd 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -2919,7 +2919,7 @@ iwl_mvm_mac_release_buffered_frames(struct ieee80211_hw *hw,
 				    int num_frames,
 				    enum ieee80211_frame_release_type reason,
 				    bool more_data);
-int iwl_mvm_mac_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
+int iwl_mvm_mac_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value);
 void iwl_mvm_sta_rc_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 			   struct ieee80211_link_sta *link_sta, u32 changed);
 void iwl_mvm_mac_mgd_prepare_tx(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/marvell/mwl8k.c b/drivers/net/wireless/marvell/mwl8k.c
index bab9ef37a1ab..57cad1a104c8 100644
--- a/drivers/net/wireless/marvell/mwl8k.c
+++ b/drivers/net/wireless/marvell/mwl8k.c
@@ -5321,7 +5321,7 @@ static void mwl8k_configure_filter(struct ieee80211_hw *hw,
 	mwl8k_fw_unlock(hw);
 }
 
-static int mwl8k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int mwl8k_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	return mwl8k_cmd_set_rts_threshold(hw, value);
 }
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
index 2e7b05eeef7a..697623d96a62 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
@@ -784,7 +784,7 @@ static void mt7615_tx(struct ieee80211_hw *hw,
 	mt76_connac_pm_queue_skb(hw, &dev->pm, wcid, skb);
 }
 
-static int mt7615_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
+static int mt7615_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 val)
 {
 	struct mt7615_dev *dev = mt7615_hw_dev(hw);
 	struct mt7615_phy *phy = mt7615_hw_phy(hw);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h
index 4cd63bacd742..1b8af4b704f8 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h
@@ -184,7 +184,7 @@ void mt76x02_tx_set_txpwr_auto(struct mt76x02_dev *dev, s8 txpwr);
 void mt76x02_set_tx_ackto(struct mt76x02_dev *dev);
 void mt76x02_set_coverage_class(struct ieee80211_hw *hw,
 				s16 coverage_class);
-int mt76x02_set_rts_threshold(struct ieee80211_hw *hw, u32 val);
+int mt76x02_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 val);
 void mt76x02_remove_hdr_pad(struct sk_buff *skb, int len);
 bool mt76x02_tx_status_data(struct mt76_dev *mdev, u8 *update);
 void mt76x02_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
index 4fb30589fa7a..314d13eb3785 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
@@ -559,7 +559,7 @@ void mt76x02_set_coverage_class(struct ieee80211_hw *hw,
 }
 EXPORT_SYMBOL_GPL(mt76x02_set_coverage_class);
 
-int mt76x02_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
+int mt76x02_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 val)
 {
 	struct mt76x02_dev *dev = hw->priv;
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
index 3aa31c5cefa6..3b43eb380681 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
@@ -906,7 +906,7 @@ static void mt7915_tx(struct ieee80211_hw *hw,
 	mt76_tx(mphy, control->sta, wcid, skb);
 }
 
-static int mt7915_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
+static int mt7915_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 val)
 {
 	struct mt7915_dev *dev = mt7915_hw_dev(hw);
 	struct mt7915_phy *phy = mt7915_hw_phy(hw);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
index 13e58c328aff..99bf04723c07 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
@@ -901,7 +901,7 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
 }
 EXPORT_SYMBOL_GPL(mt7921_mac_sta_remove);
 
-static int mt7921_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
+static int mt7921_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 val)
 {
 	struct mt792x_dev *dev = mt792x_hw_dev(hw);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 98daf80ac131..8d72fc8ebd87 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -1254,7 +1254,7 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
 }
 EXPORT_SYMBOL_GPL(mt7925_mac_sta_remove);
 
-static int mt7925_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
+static int mt7925_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 val)
 {
 	struct mt792x_dev *dev = mt792x_hw_dev(hw);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index 69dd565d8319..1f42a35e3cf9 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -887,7 +887,7 @@ static void mt7996_tx(struct ieee80211_hw *hw,
 	mt76_tx(mphy, control->sta, wcid, skb);
 }
 
-static int mt7996_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
+static int mt7996_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 val)
 {
 	struct mt7996_dev *dev = mt7996_hw_dev(hw);
 	int i, ret;
diff --git a/drivers/net/wireless/mediatek/mt7601u/main.c b/drivers/net/wireless/mediatek/mt7601u/main.c
index 7570c6ceecea..118eb52c3150 100644
--- a/drivers/net/wireless/mediatek/mt7601u/main.c
+++ b/drivers/net/wireless/mediatek/mt7601u/main.c
@@ -334,7 +334,7 @@ mt7601u_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 	return mt76_mac_wcid_set_key(dev, msta->wcid.idx, key);
 }
 
-static int mt7601u_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int mt7601u_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	struct mt7601u_dev *dev = hw->priv;
 
diff --git a/drivers/net/wireless/purelifi/plfxlc/mac.c b/drivers/net/wireless/purelifi/plfxlc/mac.c
index eae93efa6150..13e04cd6d5e6 100644
--- a/drivers/net/wireless/purelifi/plfxlc/mac.c
+++ b/drivers/net/wireless/purelifi/plfxlc/mac.c
@@ -678,7 +678,7 @@ static void plfxlc_get_et_stats(struct ieee80211_hw *hw,
 	data[1] = mac->crc_errors;
 }
 
-static int plfxlc_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int plfxlc_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	return 0;
 }
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index e5f553a1ea24..deec98c7ff5d 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -12100,7 +12100,7 @@ void rt2800_get_key_seq(struct ieee80211_hw *hw,
 }
 EXPORT_SYMBOL_GPL(rt2800_get_key_seq);
 
-int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	struct rt2x00_dev *rt2x00dev = hw->priv;
 	u32 reg;
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
index 194de676df8f..c3c4590aaaf2 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
@@ -253,7 +253,7 @@ int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev);
 void rt2800_get_key_seq(struct ieee80211_hw *hw,
 			struct ieee80211_key_conf *key,
 			struct ieee80211_key_seq *seq);
-int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
+int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value);
 int rt2800_conf_tx(struct ieee80211_hw *hw,
 		   struct ieee80211_vif *vif,
 		   unsigned int link_id, u16 queue_idx,
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index 4ce0c05c5129..8e7a3014c3ec 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -6981,7 +6981,7 @@ static void rtl8xxxu_configure_filter(struct ieee80211_hw *hw,
 			 FIF_PROBE_REQ);
 }
 
-static int rtl8xxxu_set_rts_threshold(struct ieee80211_hw *hw, u32 rts)
+static int rtl8xxxu_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 rts)
 {
 	if (rts > 2347 && rts != (u32)-1)
 		return -EINVAL;
diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c
index 026fbf4ad9cc..b44e5b50664b 100644
--- a/drivers/net/wireless/realtek/rtw88/mac80211.c
+++ b/drivers/net/wireless/realtek/rtw88/mac80211.c
@@ -706,7 +706,7 @@ static void rtw_ops_mgd_prepare_tx(struct ieee80211_hw *hw,
 	mutex_unlock(&rtwdev->mutex);
 }
 
-static int rtw_ops_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int rtw_ops_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	struct rtw_dev *rtwdev = hw->priv;
 
diff --git a/drivers/net/wireless/realtek/rtw89/mac80211.c b/drivers/net/wireless/realtek/rtw89/mac80211.c
index b3669e0074df..d984794c8c29 100644
--- a/drivers/net/wireless/realtek/rtw89/mac80211.c
+++ b/drivers/net/wireless/realtek/rtw89/mac80211.c
@@ -1038,7 +1038,7 @@ static int rtw89_ops_ampdu_action(struct ieee80211_hw *hw,
 	return 0;
 }
 
-static int rtw89_ops_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int rtw89_ops_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	struct rtw89_dev *rtwdev = hw->priv;
 
diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index 3425a473b9a1..4f0f54d591dd 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
@@ -1206,6 +1206,7 @@ static int rsi_mac80211_ampdu_action(struct ieee80211_hw *hw,
  * Return: 0 on success.
  */
 static int rsi_mac80211_set_rts_threshold(struct ieee80211_hw *hw,
+					  u8 radio_id,
 					  u32 value)
 {
 	struct rsi_hw *adapter = hw->priv;
diff --git a/drivers/net/wireless/silabs/wfx/sta.c b/drivers/net/wireless/silabs/wfx/sta.c
index 7c04810dbf3d..2d3c2bc1064b 100644
--- a/drivers/net/wireless/silabs/wfx/sta.c
+++ b/drivers/net/wireless/silabs/wfx/sta.c
@@ -219,7 +219,7 @@ int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	return 0;
 }
 
-int wfx_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+int wfx_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	struct wfx_dev *wdev = hw->priv;
 	struct wfx_vif *wvif = NULL;
diff --git a/drivers/net/wireless/silabs/wfx/sta.h b/drivers/net/wireless/silabs/wfx/sta.h
index 7817c7c6f3dd..629a579354a6 100644
--- a/drivers/net/wireless/silabs/wfx/sta.h
+++ b/drivers/net/wireless/silabs/wfx/sta.h
@@ -22,7 +22,7 @@ struct wfx_sta_priv {
 int wfx_start(struct ieee80211_hw *hw);
 void wfx_stop(struct ieee80211_hw *hw, bool suspend);
 int wfx_config(struct ieee80211_hw *hw, u32 changed);
-int wfx_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
+int wfx_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value);
 void wfx_set_default_unicast_key(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int idx);
 void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
 			  unsigned int *total_flags, u64 unused);
diff --git a/drivers/net/wireless/st/cw1200/sta.c b/drivers/net/wireless/st/cw1200/sta.c
index c259da8161e4..4732e74ddbca 100644
--- a/drivers/net/wireless/st/cw1200/sta.c
+++ b/drivers/net/wireless/st/cw1200/sta.c
@@ -857,7 +857,7 @@ void cw1200_wep_key_work(struct work_struct *work)
 	wsm_unlock_tx(priv);
 }
 
-int cw1200_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+int cw1200_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	int ret = 0;
 	__le32 val32;
diff --git a/drivers/net/wireless/st/cw1200/sta.h b/drivers/net/wireless/st/cw1200/sta.h
index b955b92cfd73..3f28bb9ec5ec 100644
--- a/drivers/net/wireless/st/cw1200/sta.h
+++ b/drivers/net/wireless/st/cw1200/sta.h
@@ -36,7 +36,7 @@ int cw1200_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd,
 		   struct ieee80211_vif *vif, struct ieee80211_sta *sta,
 		   struct ieee80211_key_conf *key);
 
-int cw1200_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
+int cw1200_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value);
 
 void cw1200_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		  u32 queues, bool drop);
diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c
index bb53d681c11b..5fcc26e7ed3b 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -1051,7 +1051,7 @@ static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
 	return ret;
 }
 
-static int wl1251_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int wl1251_op_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	struct wl1251 *wl = hw->priv;
 	int ret;
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 8fb58a5d911c..ebb30b836a64 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -3923,7 +3923,7 @@ static int wl1271_op_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
 	return ret;
 }
 
-static int wl1271_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int wl1271_op_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	struct wl1271 *wl = hw->priv;
 	struct wl12xx_vif *wlvif;
diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c
index cf6a331d4042..0c02e7f8a2e0 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim.c
@@ -3330,7 +3330,8 @@ static int mac80211_hwsim_tx_last_beacon(struct ieee80211_hw *hw)
 	return 1;
 }
 
-static int mac80211_hwsim_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int mac80211_hwsim_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+					    u32 value)
 {
 	return -EOPNOTSUPP;
 }
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index c3ed2fcff8b7..977ec1a86e60 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -4559,7 +4559,7 @@ struct ieee80211_ops {
 			    struct ieee80211_key_conf *key,
 			    struct ieee80211_key_seq *seq);
 	int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
-	int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
+	int (*set_rts_threshold)(struct ieee80211_hw *hw, u8 radio_id, u32 value);
 	int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		       struct ieee80211_sta *sta);
 	int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index ac28800fcaee..bd121815bd93 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3038,7 +3038,13 @@ static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 chan
 	}
 
 	if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
-		err = drv_set_rts_threshold(local, wiphy->rts_threshold);
+		u32 rts_threshold;
+
+		if (radio_id >= wiphy->n_radio)
+			rts_threshold = wiphy->rts_threshold;
+		else
+			rts_threshold = wiphy->radio_cfg[radio_id].rts_threshold;
+		err = drv_set_rts_threshold(local, radio_id, rts_threshold);
 
 		if (err)
 			return err;
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 5acecc7bd4a9..a47d0b7c2fe7 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -402,16 +402,16 @@ static inline int drv_set_frag_threshold(struct ieee80211_local *local,
 }
 
 static inline int drv_set_rts_threshold(struct ieee80211_local *local,
-					u32 value)
+					u8 radio_id, u32 value)
 {
 	int ret = 0;
 
 	might_sleep();
 	lockdep_assert_wiphy(local->hw.wiphy);
 
-	trace_drv_set_rts_threshold(local, value);
+	trace_drv_set_rts_threshold(local, radio_id, value);
 	if (local->ops->set_rts_threshold)
-		ret = local->ops->set_rts_threshold(&local->hw, value);
+		ret = local->ops->set_rts_threshold(&local->hw, radio_id, value);
 	trace_drv_return_int(local, ret);
 	return ret;
 }
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 72fad8ea8bb9..eb7f9c766da1 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -823,9 +823,27 @@ DEFINE_EVENT(local_u32_evt, drv_set_frag_threshold,
 	TP_ARGS(local, value)
 );
 
-DEFINE_EVENT(local_u32_evt, drv_set_rts_threshold,
-	TP_PROTO(struct ieee80211_local *local, u32 value),
-	TP_ARGS(local, value)
+TRACE_EVENT(drv_set_rts_threshold,
+	TP_PROTO(struct ieee80211_local *local, u8 radio_id, u32 value),
+
+	TP_ARGS(local, radio_id, value),
+
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		__field(u8, radio_id)
+		__field(u32, value)
+	),
+
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->radio_id = radio_id;
+		__entry->value = value;
+	),
+
+	TP_printk(
+		LOCAL_PR_FMT " value:%d",
+		LOCAL_PR_ARG, __entry->value
+	)
 );
 
 TRACE_EVENT(drv_set_coverage_class,
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index f6b631faf4f7..bc8727dd3824 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1839,7 +1839,12 @@ int ieee80211_reconfig(struct ieee80211_local *local)
 	drv_set_frag_threshold(local, hw->wiphy->frag_threshold);
 
 	/* setup RTS threshold */
-	drv_set_rts_threshold(local, hw->wiphy->rts_threshold);
+	if (hw->wiphy->n_radio)
+		for (i = 0; i < hw->wiphy->n_radio; i++)
+			drv_set_rts_threshold(local, i, hw->wiphy->radio_cfg[i].rts_threshold);
+
+	else
+		drv_set_rts_threshold(local, NL80211_WIPHY_RADIO_ID_MAX, hw->wiphy->rts_threshold);
 
 	/* reset coverage class */
 	drv_set_coverage_class(local, hw->wiphy->coverage_class);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 4/5] wifi: cfg80211: set tx power per radio in a wiphy
  2025-01-24 17:17 [PATCH v2 0/5] wifi: cfg80211/mac80211: Set/get wiphy parameters on per-radio basis Roopni Devanathan
                   ` (2 preceding siblings ...)
  2025-01-24 17:17 ` [PATCH v2 3/5] wifi: mac80211: Set RTS threshold on per-radio basis Roopni Devanathan
@ 2025-01-24 17:17 ` Roopni Devanathan
  2025-01-24 17:17 ` [PATCH v2 5/5] wifi: mac80211: " Roopni Devanathan
  4 siblings, 0 replies; 8+ messages in thread
From: Roopni Devanathan @ 2025-01-24 17:17 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless, Rameshkumar Sundaram

From: Rameshkumar Sundaram <quic_ramess@quicinc.com>

A wiphy can have multiple radios(wiphy.n_radio) combined in it
and each radio is identified by radio index (radio_id).
When set tx power is done without a valid wdev then it is
a radio level configuration but currently it is being considered at
wiphy level since radio identifier is not present in nl80211_set_wiphy().

Pass the radio id that is obtained via NL80211_ATTR_WIPHY_RADIO_INDEX as an
argument to set_tx_power op to indicate the underlying drivers about the
radio of the wiphy to which the configuration should be applied.

When NL80211_ATTR_WIPHY_RADIO_INDEX is not passed or the wiphy is a
non-multi radio wiphy, radio id value of NL80211_WIPHY_RADIO_ID_MAX(255)
is passed in which case drivers should apply the configuration to all
radios.

Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
---
 drivers/net/wireless/ath/ath6kl/cfg80211.c            |  1 +
 .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c   |  2 +-
 drivers/net/wireless/marvell/mwifiex/cfg80211.c       |  2 +-
 drivers/net/wireless/microchip/wilc1000/cfg80211.c    |  2 +-
 drivers/net/wireless/quantenna/qtnfmac/cfg80211.c     |  2 +-
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c     |  2 +-
 include/net/cfg80211.h                                |  2 +-
 net/mac80211/cfg.c                                    |  2 +-
 net/wireless/nl80211.c                                |  2 +-
 net/wireless/rdev-ops.h                               |  6 +++---
 net/wireless/trace.h                                  | 11 +++++++----
 net/wireless/wext-compat.c                            |  3 ++-
 12 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 120dbd66ea11..bf23daec8662 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -1405,6 +1405,7 @@ static int ath6kl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u3
 
 static int ath6kl_cfg80211_set_txpower(struct wiphy *wiphy,
 				       struct wireless_dev *wdev,
+				       u8 radio_id,
 				       enum nl80211_tx_power_setting type,
 				       int mbm)
 {
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 418b9dadb039..6a7c4c06585c 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -2628,7 +2628,7 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
 }
 
 static s32
-brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
+brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, u8 radio_id,
 			    enum nl80211_tx_power_setting type, s32 mbm)
 {
 	struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 8f1929ee2a92..a6ae8011f14b 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -374,7 +374,7 @@ mwifiex_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy,
  */
 static int
 mwifiex_cfg80211_set_tx_power(struct wiphy *wiphy,
-			      struct wireless_dev *wdev,
+			      struct wireless_dev *wdev, u8 radio_id,
 			      enum nl80211_tx_power_setting type,
 			      int mbm)
 {
diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
index 2de0834d76cd..b8b5ec062c3a 100644
--- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c
+++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
@@ -1636,7 +1636,7 @@ static void wilc_set_wakeup(struct wiphy *wiphy, bool enabled)
 	srcu_read_unlock(&wl->srcu, srcu_idx);
 }
 
-static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
+static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, u8 radio_id,
 			enum nl80211_tx_power_setting type, int mbm)
 {
 	int ret;
diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
index e4ba386f6265..7c1a378726fc 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
@@ -894,7 +894,7 @@ static int qtnf_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
 }
 
 static int qtnf_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
-			     enum nl80211_tx_power_setting type, int mbm)
+			     u8 radio_id, enum nl80211_tx_power_setting type, int mbm)
 {
 	struct qtnf_vif *vif;
 	int ret;
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index c7458bf9a7f1..eddea77b9cec 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -1795,7 +1795,7 @@ static int cfg80211_rtw_disconnect(struct wiphy *wiphy, struct net_device *ndev,
 }
 
 static int cfg80211_rtw_set_txpower(struct wiphy *wiphy,
-				    struct wireless_dev *wdev,
+				    struct wireless_dev *wdev, u8 radio_id,
 				    enum nl80211_tx_power_setting type, int mbm)
 {
 	return 0;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9cbce47fcea6..24e5d7cfb9e5 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4753,7 +4753,7 @@ struct cfg80211_ops {
 	int	(*set_wiphy_params)(struct wiphy *wiphy, u8 radio_id, u32 changed);
 
 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
-				enum nl80211_tx_power_setting type, int mbm);
+				u8 radio_id, enum nl80211_tx_power_setting type, int mbm);
 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
 				unsigned int link_id, int *dbm);
 
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index bd121815bd93..f86350b3a668 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3073,7 +3073,7 @@ static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u8 radio_id, u32 chan
 }
 
 static int ieee80211_set_tx_power(struct wiphy *wiphy,
-				  struct wireless_dev *wdev,
+				  struct wireless_dev *wdev, u8 radio_id,
 				  enum nl80211_tx_power_setting type, int mbm)
 {
 	struct ieee80211_local *local = wiphy_priv(wiphy);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index e2e70250527e..b6a1fe4fce29 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3766,7 +3766,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
 			mbm = nla_get_u32(info->attrs[idx]);
 		}
 
-		result = rdev_set_tx_power(rdev, txp_wdev, type, mbm);
+		result = rdev_set_tx_power(rdev, txp_wdev, radio_id, type, mbm);
 		if (result)
 			return result;
 	}
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index 0b4185013fb2..c22a458e8158 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -589,12 +589,12 @@ rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u8 radio_id, u32
 }
 
 static inline int rdev_set_tx_power(struct cfg80211_registered_device *rdev,
-				    struct wireless_dev *wdev,
+				    struct wireless_dev *wdev, u8 radio_id,
 				    enum nl80211_tx_power_setting type, int mbm)
 {
 	int ret;
-	trace_rdev_set_tx_power(&rdev->wiphy, wdev, type, mbm);
-	ret = rdev->ops->set_tx_power(&rdev->wiphy, wdev, type, mbm);
+	trace_rdev_set_tx_power(&rdev->wiphy, wdev, radio_id, type, mbm);
+	ret = rdev->ops->set_tx_power(&rdev->wiphy, wdev, radio_id, type, mbm);
 	trace_rdev_return_int(&rdev->wiphy, ret);
 	return ret;
 }
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 5fd600f54e0a..98ec4f3e8ec7 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -1716,23 +1716,26 @@ DEFINE_EVENT(wiphy_wdev_link_evt, rdev_get_tx_power,
 );
 
 TRACE_EVENT(rdev_set_tx_power,
-	TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev,
+	TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, u8 radio_id,
 		 enum nl80211_tx_power_setting type, int mbm),
-	TP_ARGS(wiphy, wdev, type, mbm),
+	TP_ARGS(wiphy, wdev, radio_id, type, mbm),
 	TP_STRUCT__entry(
 		WIPHY_ENTRY
 		WDEV_ENTRY
+		__field(u8, radio_id)
 		__field(enum nl80211_tx_power_setting, type)
 		__field(int, mbm)
 	),
 	TP_fast_assign(
 		WIPHY_ASSIGN;
 		WDEV_ASSIGN;
+		__entry->radio_id = radio_id;
 		__entry->type = type;
 		__entry->mbm = mbm;
 	),
-	TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT ", type: %u, mbm: %d",
-		  WIPHY_PR_ARG, WDEV_PR_ARG,__entry->type, __entry->mbm)
+	TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT ", radio_id: %u, type: %u, mbm: %d",
+		  WIPHY_PR_ARG, WDEV_PR_ARG, __entry->radio_id, __entry->type,
+		  __entry->mbm)
 );
 
 TRACE_EVENT(rdev_return_int_int,
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index fd4a4112610e..3f1112fa56e8 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -892,7 +892,8 @@ static int cfg80211_wext_siwtxpower(struct net_device *dev,
 
 	guard(wiphy)(&rdev->wiphy);
 
-	return rdev_set_tx_power(rdev, wdev, type, DBM_TO_MBM(dbm));
+	return rdev_set_tx_power(rdev, wdev, NL80211_WIPHY_RADIO_ID_MAX, type,
+				 DBM_TO_MBM(dbm));
 }
 
 static int cfg80211_wext_giwtxpower(struct net_device *dev,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 5/5] wifi: mac80211: set tx power per radio in a wiphy
  2025-01-24 17:17 [PATCH v2 0/5] wifi: cfg80211/mac80211: Set/get wiphy parameters on per-radio basis Roopni Devanathan
                   ` (3 preceding siblings ...)
  2025-01-24 17:17 ` [PATCH v2 4/5] wifi: cfg80211: set tx power per radio in a wiphy Roopni Devanathan
@ 2025-01-24 17:17 ` Roopni Devanathan
  4 siblings, 0 replies; 8+ messages in thread
From: Roopni Devanathan @ 2025-01-24 17:17 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless, Rameshkumar Sundaram

From: Rameshkumar Sundaram <quic_ramess@quicinc.com>

If set tx power is being done without a valid wdev/sdata
then the configuration applies to the radio but currently
it is being done at wiphy level(i.e. to all radios of wiphy)
since radio identifier is not available.

Use the radio_id argument of ieee80211_set_tx_power() to identify
to which radio of the wiphy the configuration should be applied.
If the wiphy is a multi-radio wiphy(wiphy.n_radios > 0), validate the
radio index of link's channel context against the radio id provided
and apply the configuration.

radio id value of NL80211_WIPHY_RADIO_ID_MAX(255) indicates that radio
index is not mentioned and the configuration applies to all radio(s) of
the wiphy.

Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
---
 net/mac80211/cfg.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index f86350b3a668..ed769672ea77 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3079,6 +3079,7 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy,
 	struct ieee80211_local *local = wiphy_priv(wiphy);
 	struct ieee80211_sub_if_data *sdata;
 	enum nl80211_tx_power_setting txp_type = type;
+	struct ieee80211_chanctx_conf *conf;
 	bool update_txp_type = false;
 	bool has_monitor = false;
 	int user_power_level;
@@ -3154,6 +3155,12 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy,
 			if (!link)
 				continue;
 
+			if (radio_id < wiphy->n_radio) {
+				conf = wiphy_dereference(wiphy, link->conf->chanctx_conf);
+				if (!conf || conf->radio_idx != radio_id)
+					continue;
+			}
+
 			link->user_power_level = local->user_power_level;
 			if (txp_type != link->conf->txpower_type)
 				update_txp_type = true;
@@ -3174,6 +3181,12 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy,
 			if (!link)
 				continue;
 
+			if (radio_id < wiphy->n_radio) {
+				conf = wiphy_dereference(wiphy, link->conf->chanctx_conf);
+				if (!conf || conf->radio_idx != radio_id)
+					continue;
+			}
+
 			ieee80211_recalc_txpower(link, update_txp_type);
 		}
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 3/5] wifi: mac80211: Set RTS threshold on per-radio basis
  2025-01-24 17:17 ` [PATCH v2 3/5] wifi: mac80211: Set RTS threshold on per-radio basis Roopni Devanathan
@ 2025-01-25 11:49   ` kernel test robot
  0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2025-01-25 11:49 UTC (permalink / raw)
  To: Roopni Devanathan, ath12k
  Cc: oe-kbuild-all, linux-wireless, Roopni Devanathan

Hi Roopni,

kernel test robot noticed the following build warnings:

[auto build test WARNING on e7ef944b3e2c31b608800925e784f67596375770]

url:    https://github.com/intel-lab-lkp/linux/commits/Roopni-Devanathan/wifi-cfg80211-Add-Support-to-Set-RTS-Threshold-for-each-Radio/20250125-012016
base:   e7ef944b3e2c31b608800925e784f67596375770
patch link:    https://lore.kernel.org/r/20250124171756.3418663-4-quic_rdevanat%40quicinc.com
patch subject: [PATCH v2 3/5] wifi: mac80211: Set RTS threshold on per-radio basis
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20250125/202501251909.8i7nEm4H-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250125/202501251909.8i7nEm4H-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501251909.8i7nEm4H-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/wireless/rsi/rsi_91x_mac80211.c:1211: warning: Function parameter or struct member 'radio_id' not described in 'rsi_mac80211_set_rts_threshold'


vim +1211 drivers/net/wireless/rsi/rsi_91x_mac80211.c

dad0d04fa7ba41 Fariya Fatima     2014-03-16  1200  
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1201  /**
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1202   * rsi_mac80211_set_rts_threshold() - This function sets rts threshold value.
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1203   * @hw: Pointer to the ieee80211_hw structure.
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1204   * @value: Rts threshold value.
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1205   *
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1206   * Return: 0 on success.
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1207   */
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1208  static int rsi_mac80211_set_rts_threshold(struct ieee80211_hw *hw,
607be4e860ab07 Roopni Devanathan 2025-01-24  1209  					  u8 radio_id,
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1210  					  u32 value)
dad0d04fa7ba41 Fariya Fatima     2014-03-16 @1211  {
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1212  	struct rsi_hw *adapter = hw->priv;
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1213  	struct rsi_common *common = adapter->priv;
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1214  
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1215  	mutex_lock(&common->mutex);
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1216  	common->rts_threshold = value;
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1217  	mutex_unlock(&common->mutex);
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1218  
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1219  	return 0;
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1220  }
dad0d04fa7ba41 Fariya Fatima     2014-03-16  1221  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/5] wifi: cfg80211: Add Support to Set RTS Threshold for each Radio
  2025-01-24 17:17 ` [PATCH v2 1/5] wifi: cfg80211: Add Support to Set RTS Threshold for each Radio Roopni Devanathan
@ 2025-01-25 15:40   ` kernel test robot
  0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2025-01-25 15:40 UTC (permalink / raw)
  To: Roopni Devanathan, ath12k
  Cc: llvm, oe-kbuild-all, linux-wireless, Roopni Devanathan

Hi Roopni,

kernel test robot noticed the following build warnings:

[auto build test WARNING on e7ef944b3e2c31b608800925e784f67596375770]

url:    https://github.com/intel-lab-lkp/linux/commits/Roopni-Devanathan/wifi-cfg80211-Add-Support-to-Set-RTS-Threshold-for-each-Radio/20250125-012016
base:   e7ef944b3e2c31b608800925e784f67596375770
patch link:    https://lore.kernel.org/r/20250124171756.3418663-2-quic_rdevanat%40quicinc.com
patch subject: [PATCH v2 1/5] wifi: cfg80211: Add Support to Set RTS Threshold for each Radio
config: arm-imx_v6_v7_defconfig (https://download.01.org/0day-ci/archive/20250125/202501252150.mBnKxse3-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 19306351a2c45e266fa11b41eb1362b20b6ca56d)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250125/202501252150.mBnKxse3-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501252150.mBnKxse3-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> net/wireless/nl80211.c:3603:12: warning: stack frame size (1128) exceeds limit (1024) in 'nl80211_set_wiphy' [-Wframe-larger-than]
    3603 | static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
         |            ^
   1 warning generated.


vim +/nl80211_set_wiphy +3603 net/wireless/nl80211.c

f444de05d20e27 Johannes Berg          2010-05-05  3602  
556829657397b9 Johannes Berg          2007-09-20 @3603  static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
556829657397b9 Johannes Berg          2007-09-20  3604  {
a05829a7222e9d Johannes Berg          2021-01-22  3605  	struct cfg80211_registered_device *rdev = NULL;
f444de05d20e27 Johannes Berg          2010-05-05  3606  	struct net_device *netdev = NULL;
f444de05d20e27 Johannes Berg          2010-05-05  3607  	struct wireless_dev *wdev;
a1e567c83f5414 Bill Jordan            2010-09-10  3608  	int result = 0, rem_txq_params = 0;
318884875bdddc Jouni Malinen          2008-10-30  3609  	struct nlattr *nl_txq_params;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3610  	u32 changed;
c23c182175594b Roopni Devanathan      2025-01-24  3611  	u8 retry_short = 0, retry_long = 0, radio_id = NL80211_WIPHY_RADIO_ID_MAX;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3612  	u32 frag_threshold = 0, rts_threshold = 0;
81077e82c3f591 Lukáš Turek            2009-12-21  3613  	u8 coverage_class = 0;
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3614  	u32 txq_limit = 0, txq_memory_limit = 0, txq_quantum = 0;
556829657397b9 Johannes Berg          2007-09-20  3615  
a05829a7222e9d Johannes Berg          2021-01-22  3616  	rtnl_lock();
f444de05d20e27 Johannes Berg          2010-05-05  3617  	/*
f444de05d20e27 Johannes Berg          2010-05-05  3618  	 * Try to find the wiphy and netdev. Normally this
f444de05d20e27 Johannes Berg          2010-05-05  3619  	 * function shouldn't need the netdev, but this is
f444de05d20e27 Johannes Berg          2010-05-05  3620  	 * done for backward compatibility -- previously
f444de05d20e27 Johannes Berg          2010-05-05  3621  	 * setting the channel was done per wiphy, but now
f444de05d20e27 Johannes Berg          2010-05-05  3622  	 * it is per netdev. Previous userland like hostapd
f444de05d20e27 Johannes Berg          2010-05-05  3623  	 * also passed a netdev to set_wiphy, so that it is
f444de05d20e27 Johannes Berg          2010-05-05  3624  	 * possible to let that go to the right netdev!
f444de05d20e27 Johannes Berg          2010-05-05  3625  	 */
4bbf4d56583dd5 Johannes Berg          2009-03-24  3626  
f444de05d20e27 Johannes Berg          2010-05-05  3627  	if (info->attrs[NL80211_ATTR_IFINDEX]) {
f444de05d20e27 Johannes Berg          2010-05-05  3628  		int ifindex = nla_get_u32(info->attrs[NL80211_ATTR_IFINDEX]);
f444de05d20e27 Johannes Berg          2010-05-05  3629  
7f2b8562c2ee6e Ying Xue               2014-01-15  3630  		netdev = __dev_get_by_index(genl_info_net(info), ifindex);
5fe231e873729f Johannes Berg          2013-05-08  3631  		if (netdev && netdev->ieee80211_ptr)
f26cbf401be935 Zhao, Gang             2014-04-21  3632  			rdev = wiphy_to_rdev(netdev->ieee80211_ptr->wiphy);
5fe231e873729f Johannes Berg          2013-05-08  3633  		else
f444de05d20e27 Johannes Berg          2010-05-05  3634  			netdev = NULL;
f444de05d20e27 Johannes Berg          2010-05-05  3635  	}
f444de05d20e27 Johannes Berg          2010-05-05  3636  
f444de05d20e27 Johannes Berg          2010-05-05  3637  	if (!netdev) {
878d9ec7367816 Johannes Berg          2012-06-15  3638  		rdev = __cfg80211_rdev_from_attrs(genl_info_net(info),
878d9ec7367816 Johannes Berg          2012-06-15  3639  						  info->attrs);
a05829a7222e9d Johannes Berg          2021-01-22  3640  		if (IS_ERR(rdev)) {
a05829a7222e9d Johannes Berg          2021-01-22  3641  			rtnl_unlock();
4c476991062a0a Johannes Berg          2010-10-04  3642  			return PTR_ERR(rdev);
a05829a7222e9d Johannes Berg          2021-01-22  3643  		}
f444de05d20e27 Johannes Berg          2010-05-05  3644  		wdev = NULL;
f444de05d20e27 Johannes Berg          2010-05-05  3645  		netdev = NULL;
f444de05d20e27 Johannes Berg          2010-05-05  3646  		result = 0;
71fe96bf9db8b1 Johannes Berg          2012-10-24  3647  	} else
f444de05d20e27 Johannes Berg          2010-05-05  3648  		wdev = netdev->ieee80211_ptr;
f444de05d20e27 Johannes Berg          2010-05-05  3649  
f42d22d3f79639 Johannes Berg          2024-11-22  3650  	guard(wiphy)(&rdev->wiphy);
a05829a7222e9d Johannes Berg          2021-01-22  3651  
f444de05d20e27 Johannes Berg          2010-05-05  3652  	/*
f444de05d20e27 Johannes Berg          2010-05-05  3653  	 * end workaround code, by now the rdev is available
f444de05d20e27 Johannes Berg          2010-05-05  3654  	 * and locked, and wdev may or may not be NULL.
f444de05d20e27 Johannes Berg          2010-05-05  3655  	 */
4bbf4d56583dd5 Johannes Berg          2009-03-24  3656  
4bbf4d56583dd5 Johannes Berg          2009-03-24  3657  	if (info->attrs[NL80211_ATTR_WIPHY_NAME])
318884875bdddc Jouni Malinen          2008-10-30  3658  		result = cfg80211_dev_rename(
318884875bdddc Jouni Malinen          2008-10-30  3659  			rdev, nla_data(info->attrs[NL80211_ATTR_WIPHY_NAME]));
0391a45c800780 Johannes Berg          2021-01-28  3660  	rtnl_unlock();
4bbf4d56583dd5 Johannes Berg          2009-03-24  3661  
318884875bdddc Jouni Malinen          2008-10-30  3662  	if (result)
f42d22d3f79639 Johannes Berg          2024-11-22  3663  		return result;
318884875bdddc Jouni Malinen          2008-10-30  3664  
c23c182175594b Roopni Devanathan      2025-01-24  3665  	if (info->attrs[NL80211_ATTR_WIPHY_RADIO_INDEX]) {
c23c182175594b Roopni Devanathan      2025-01-24  3666  		/* Radio idx is not expected for non-multi radio wiphy */
c23c182175594b Roopni Devanathan      2025-01-24  3667  		if (!rdev->wiphy.n_radio)
c23c182175594b Roopni Devanathan      2025-01-24  3668  			return -EINVAL;
c23c182175594b Roopni Devanathan      2025-01-24  3669  
c23c182175594b Roopni Devanathan      2025-01-24  3670  		radio_id = nla_get_u8(info->attrs[NL80211_ATTR_WIPHY_RADIO_INDEX]);
c23c182175594b Roopni Devanathan      2025-01-24  3671  		if (radio_id > rdev->wiphy.n_radio)
c23c182175594b Roopni Devanathan      2025-01-24  3672  			return -EINVAL;
c23c182175594b Roopni Devanathan      2025-01-24  3673  	}
c23c182175594b Roopni Devanathan      2025-01-24  3674  
318884875bdddc Jouni Malinen          2008-10-30  3675  	if (info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS]) {
318884875bdddc Jouni Malinen          2008-10-30  3676  		struct ieee80211_txq_params txq_params;
318884875bdddc Jouni Malinen          2008-10-30  3677  		struct nlattr *tb[NL80211_TXQ_ATTR_MAX + 1];
318884875bdddc Jouni Malinen          2008-10-30  3678  
f42d22d3f79639 Johannes Berg          2024-11-22  3679  		if (!rdev->ops->set_txq_params)
f42d22d3f79639 Johannes Berg          2024-11-22  3680  			return -EOPNOTSUPP;
318884875bdddc Jouni Malinen          2008-10-30  3681  
f42d22d3f79639 Johannes Berg          2024-11-22  3682  		if (!netdev)
f42d22d3f79639 Johannes Berg          2024-11-22  3683  			return -EINVAL;
f70f01c2ebbe31 Eliad Peller           2011-09-25  3684  
133a3ff2c93422 Johannes Berg          2011-11-03  3685  		if (netdev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
f42d22d3f79639 Johannes Berg          2024-11-22  3686  		    netdev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
f42d22d3f79639 Johannes Berg          2024-11-22  3687  			return -EINVAL;
133a3ff2c93422 Johannes Berg          2011-11-03  3688  
f42d22d3f79639 Johannes Berg          2024-11-22  3689  		if (!netif_running(netdev))
f42d22d3f79639 Johannes Berg          2024-11-22  3690  			return -ENETDOWN;
2b5f8b0b44e17e Johannes Berg          2012-04-02  3691  
318884875bdddc Jouni Malinen          2008-10-30  3692  		nla_for_each_nested(nl_txq_params,
318884875bdddc Jouni Malinen          2008-10-30  3693  				    info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS],
318884875bdddc Jouni Malinen          2008-10-30  3694  				    rem_txq_params) {
8cb081746c031f Johannes Berg          2019-04-26  3695  			result = nla_parse_nested_deprecated(tb,
8cb081746c031f Johannes Berg          2019-04-26  3696  							     NL80211_TXQ_ATTR_MAX,
bfe2c7b1cce4a1 Johannes Berg          2016-10-26  3697  							     nl_txq_params,
fe52145f91fe81 Johannes Berg          2017-04-12  3698  							     txq_params_policy,
fe52145f91fe81 Johannes Berg          2017-04-12  3699  							     info->extack);
ae811e21df28de Johannes Berg          2014-01-24  3700  			if (result)
f42d22d3f79639 Johannes Berg          2024-11-22  3701  				return result;
f42d22d3f79639 Johannes Berg          2024-11-22  3702  
318884875bdddc Jouni Malinen          2008-10-30  3703  			result = parse_txq_params(tb, &txq_params);
318884875bdddc Jouni Malinen          2008-10-30  3704  			if (result)
f42d22d3f79639 Johannes Berg          2024-11-22  3705  				return result;
318884875bdddc Jouni Malinen          2008-10-30  3706  
9d2bb84d54a403 Shaul Triebitz         2022-08-02  3707  			txq_params.link_id =
9d2bb84d54a403 Shaul Triebitz         2022-08-02  3708  				nl80211_link_id_or_invalid(info->attrs);
9d2bb84d54a403 Shaul Triebitz         2022-08-02  3709  
9d2bb84d54a403 Shaul Triebitz         2022-08-02  3710  			if (txq_params.link_id >= 0 &&
9d2bb84d54a403 Shaul Triebitz         2022-08-02  3711  			    !(netdev->ieee80211_ptr->valid_links &
9d2bb84d54a403 Shaul Triebitz         2022-08-02  3712  			      BIT(txq_params.link_id)))
9d2bb84d54a403 Shaul Triebitz         2022-08-02  3713  				result = -ENOLINK;
9d2bb84d54a403 Shaul Triebitz         2022-08-02  3714  			else if (txq_params.link_id >= 0 &&
9d2bb84d54a403 Shaul Triebitz         2022-08-02  3715  				 !netdev->ieee80211_ptr->valid_links)
9d2bb84d54a403 Shaul Triebitz         2022-08-02  3716  				result = -EINVAL;
9d2bb84d54a403 Shaul Triebitz         2022-08-02  3717  			else
e35e4d28b687d4 Hila Gonen             2012-06-27  3718  				result = rdev_set_txq_params(rdev, netdev,
318884875bdddc Jouni Malinen          2008-10-30  3719  							     &txq_params);
318884875bdddc Jouni Malinen          2008-10-30  3720  			if (result)
f42d22d3f79639 Johannes Berg          2024-11-22  3721  				return result;
318884875bdddc Jouni Malinen          2008-10-30  3722  		}
318884875bdddc Jouni Malinen          2008-10-30  3723  	}
556829657397b9 Johannes Berg          2007-09-20  3724  
72bdcf34380917 Jouni Malinen          2008-11-26  3725  	if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) {
69c3f2d30c3576 Ilan Peer              2022-06-12  3726  		int link_id = nl80211_link_id_or_invalid(info->attrs);
69c3f2d30c3576 Ilan Peer              2022-06-12  3727  
4e2f3d67e3afef Johannes Berg          2022-06-20  3728  		if (wdev) {
e16821bcfb364b Jouni Malinen          2014-04-28  3729  			result = __nl80211_set_channel(
e16821bcfb364b Jouni Malinen          2014-04-28  3730  				rdev,
e16821bcfb364b Jouni Malinen          2014-04-28  3731  				nl80211_can_set_dev_channel(wdev) ? netdev : NULL,
69c3f2d30c3576 Ilan Peer              2022-06-12  3732  				info, link_id);
4e2f3d67e3afef Johannes Berg          2022-06-20  3733  		} else {
69c3f2d30c3576 Ilan Peer              2022-06-12  3734  			result = __nl80211_set_channel(rdev, netdev, info, link_id);
4e2f3d67e3afef Johannes Berg          2022-06-20  3735  		}
69c3f2d30c3576 Ilan Peer              2022-06-12  3736  
72bdcf34380917 Jouni Malinen          2008-11-26  3737  		if (result)
f42d22d3f79639 Johannes Berg          2024-11-22  3738  			return result;
72bdcf34380917 Jouni Malinen          2008-11-26  3739  	}
72bdcf34380917 Jouni Malinen          2008-11-26  3740  
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3741  	if (info->attrs[NL80211_ATTR_WIPHY_TX_POWER_SETTING]) {
c8442118ad9cd0 Johannes Berg          2012-10-24  3742  		struct wireless_dev *txp_wdev = wdev;
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3743  		enum nl80211_tx_power_setting type;
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3744  		int idx, mbm = 0;
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3745  
c8442118ad9cd0 Johannes Berg          2012-10-24  3746  		if (!(rdev->wiphy.features & NL80211_FEATURE_VIF_TXPOWER))
c8442118ad9cd0 Johannes Berg          2012-10-24  3747  			txp_wdev = NULL;
c8442118ad9cd0 Johannes Berg          2012-10-24  3748  
f42d22d3f79639 Johannes Berg          2024-11-22  3749  		if (!rdev->ops->set_tx_power)
f42d22d3f79639 Johannes Berg          2024-11-22  3750  			return -EOPNOTSUPP;
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3751  
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3752  		idx = NL80211_ATTR_WIPHY_TX_POWER_SETTING;
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3753  		type = nla_get_u32(info->attrs[idx]);
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3754  
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3755  		if (!info->attrs[NL80211_ATTR_WIPHY_TX_POWER_LEVEL] &&
f42d22d3f79639 Johannes Berg          2024-11-22  3756  		    (type != NL80211_TX_POWER_AUTOMATIC))
f42d22d3f79639 Johannes Berg          2024-11-22  3757  			return -EINVAL;
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3758  
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3759  		if (type != NL80211_TX_POWER_AUTOMATIC) {
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3760  			idx = NL80211_ATTR_WIPHY_TX_POWER_LEVEL;
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3761  			mbm = nla_get_u32(info->attrs[idx]);
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3762  		}
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3763  
c8442118ad9cd0 Johannes Berg          2012-10-24  3764  		result = rdev_set_tx_power(rdev, txp_wdev, type, mbm);
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3765  		if (result)
f42d22d3f79639 Johannes Berg          2024-11-22  3766  			return result;
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3767  	}
98d2ff8bec82fc Juuso Oikarinen        2010-06-23  3768  
afe0cbf87500f0 Bruno Randolf          2010-11-10  3769  	if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_TX] &&
afe0cbf87500f0 Bruno Randolf          2010-11-10  3770  	    info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]) {
afe0cbf87500f0 Bruno Randolf          2010-11-10  3771  		u32 tx_ant, rx_ant;
7a087e7484c9e4 Kirtika Ruchandani     2016-05-29  3772  
7f531e03abf016 Bruno Randolf          2010-12-16  3773  		if ((!rdev->wiphy.available_antennas_tx &&
7f531e03abf016 Bruno Randolf          2010-12-16  3774  		     !rdev->wiphy.available_antennas_rx) ||
f42d22d3f79639 Johannes Berg          2024-11-22  3775  		    !rdev->ops->set_antenna)
f42d22d3f79639 Johannes Berg          2024-11-22  3776  			return -EOPNOTSUPP;
afe0cbf87500f0 Bruno Randolf          2010-11-10  3777  
afe0cbf87500f0 Bruno Randolf          2010-11-10  3778  		tx_ant = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_ANTENNA_TX]);
afe0cbf87500f0 Bruno Randolf          2010-11-10  3779  		rx_ant = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]);
afe0cbf87500f0 Bruno Randolf          2010-11-10  3780  
a7ffac9591a2a0 Bruno Randolf          2010-12-08  3781  		/* reject antenna configurations which don't match the
7f531e03abf016 Bruno Randolf          2010-12-16  3782  		 * available antenna masks, except for the "all" mask */
7f531e03abf016 Bruno Randolf          2010-12-16  3783  		if ((~tx_ant && (tx_ant & ~rdev->wiphy.available_antennas_tx)) ||
f42d22d3f79639 Johannes Berg          2024-11-22  3784  		    (~rx_ant && (rx_ant & ~rdev->wiphy.available_antennas_rx)))
f42d22d3f79639 Johannes Berg          2024-11-22  3785  			return -EINVAL;
a7ffac9591a2a0 Bruno Randolf          2010-12-08  3786  
7f531e03abf016 Bruno Randolf          2010-12-16  3787  		tx_ant = tx_ant & rdev->wiphy.available_antennas_tx;
7f531e03abf016 Bruno Randolf          2010-12-16  3788  		rx_ant = rx_ant & rdev->wiphy.available_antennas_rx;
a7ffac9591a2a0 Bruno Randolf          2010-12-08  3789  
e35e4d28b687d4 Hila Gonen             2012-06-27  3790  		result = rdev_set_antenna(rdev, tx_ant, rx_ant);
afe0cbf87500f0 Bruno Randolf          2010-11-10  3791  		if (result)
f42d22d3f79639 Johannes Berg          2024-11-22  3792  			return result;
afe0cbf87500f0 Bruno Randolf          2010-11-10  3793  	}
afe0cbf87500f0 Bruno Randolf          2010-11-10  3794  
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3795  	changed = 0;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3796  
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3797  	if (info->attrs[NL80211_ATTR_WIPHY_RETRY_SHORT]) {
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3798  		retry_short = nla_get_u8(
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3799  			info->attrs[NL80211_ATTR_WIPHY_RETRY_SHORT]);
7f2b8562c2ee6e Ying Xue               2014-01-15  3800  
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3801  		changed |= WIPHY_PARAM_RETRY_SHORT;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3802  	}
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3803  
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3804  	if (info->attrs[NL80211_ATTR_WIPHY_RETRY_LONG]) {
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3805  		retry_long = nla_get_u8(
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3806  			info->attrs[NL80211_ATTR_WIPHY_RETRY_LONG]);
7f2b8562c2ee6e Ying Xue               2014-01-15  3807  
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3808  		changed |= WIPHY_PARAM_RETRY_LONG;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3809  	}
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3810  
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3811  	if (info->attrs[NL80211_ATTR_WIPHY_FRAG_THRESHOLD]) {
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3812  		frag_threshold = nla_get_u32(
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3813  			info->attrs[NL80211_ATTR_WIPHY_FRAG_THRESHOLD]);
f42d22d3f79639 Johannes Berg          2024-11-22  3814  		if (frag_threshold < 256)
f42d22d3f79639 Johannes Berg          2024-11-22  3815  			return -EINVAL;
7f2b8562c2ee6e Ying Xue               2014-01-15  3816  
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3817  		if (frag_threshold != (u32) -1) {
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3818  			/*
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3819  			 * Fragments (apart from the last one) are required to
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3820  			 * have even length. Make the fragmentation code
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3821  			 * simpler by stripping LSB should someone try to use
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3822  			 * odd threshold value.
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3823  			 */
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3824  			frag_threshold &= ~0x1;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3825  		}
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3826  		changed |= WIPHY_PARAM_FRAG_THRESHOLD;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3827  	}
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3828  
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3829  	if (info->attrs[NL80211_ATTR_WIPHY_RTS_THRESHOLD]) {
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3830  		rts_threshold = nla_get_u32(
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3831  			info->attrs[NL80211_ATTR_WIPHY_RTS_THRESHOLD]);
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3832  		changed |= WIPHY_PARAM_RTS_THRESHOLD;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3833  	}
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3834  
81077e82c3f591 Lukáš Turek            2009-12-21  3835  	if (info->attrs[NL80211_ATTR_WIPHY_COVERAGE_CLASS]) {
f42d22d3f79639 Johannes Berg          2024-11-22  3836  		if (info->attrs[NL80211_ATTR_WIPHY_DYN_ACK])
f42d22d3f79639 Johannes Berg          2024-11-22  3837  			return -EINVAL;
3057dbfdab1b86 Lorenzo Bianconi       2014-09-04  3838  
81077e82c3f591 Lukáš Turek            2009-12-21  3839  		coverage_class = nla_get_u8(
81077e82c3f591 Lukáš Turek            2009-12-21  3840  			info->attrs[NL80211_ATTR_WIPHY_COVERAGE_CLASS]);
81077e82c3f591 Lukáš Turek            2009-12-21  3841  		changed |= WIPHY_PARAM_COVERAGE_CLASS;
81077e82c3f591 Lukáš Turek            2009-12-21  3842  	}
81077e82c3f591 Lukáš Turek            2009-12-21  3843  
3057dbfdab1b86 Lorenzo Bianconi       2014-09-04  3844  	if (info->attrs[NL80211_ATTR_WIPHY_DYN_ACK]) {
f42d22d3f79639 Johannes Berg          2024-11-22  3845  		if (!(rdev->wiphy.features & NL80211_FEATURE_ACKTO_ESTIMATION))
f42d22d3f79639 Johannes Berg          2024-11-22  3846  			return -EOPNOTSUPP;
3057dbfdab1b86 Lorenzo Bianconi       2014-09-04  3847  
3057dbfdab1b86 Lorenzo Bianconi       2014-09-04  3848  		changed |= WIPHY_PARAM_DYN_ACK;
81077e82c3f591 Lukáš Turek            2009-12-21  3849  	}
81077e82c3f591 Lukáš Turek            2009-12-21  3850  
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3851  	if (info->attrs[NL80211_ATTR_TXQ_LIMIT]) {
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3852  		if (!wiphy_ext_feature_isset(&rdev->wiphy,
f42d22d3f79639 Johannes Berg          2024-11-22  3853  					     NL80211_EXT_FEATURE_TXQS))
f42d22d3f79639 Johannes Berg          2024-11-22  3854  			return -EOPNOTSUPP;
f42d22d3f79639 Johannes Berg          2024-11-22  3855  
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3856  		txq_limit = nla_get_u32(
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3857  			info->attrs[NL80211_ATTR_TXQ_LIMIT]);
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3858  		changed |= WIPHY_PARAM_TXQ_LIMIT;
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3859  	}
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3860  
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3861  	if (info->attrs[NL80211_ATTR_TXQ_MEMORY_LIMIT]) {
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3862  		if (!wiphy_ext_feature_isset(&rdev->wiphy,
f42d22d3f79639 Johannes Berg          2024-11-22  3863  					     NL80211_EXT_FEATURE_TXQS))
f42d22d3f79639 Johannes Berg          2024-11-22  3864  			return -EOPNOTSUPP;
f42d22d3f79639 Johannes Berg          2024-11-22  3865  
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3866  		txq_memory_limit = nla_get_u32(
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3867  			info->attrs[NL80211_ATTR_TXQ_MEMORY_LIMIT]);
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3868  		changed |= WIPHY_PARAM_TXQ_MEMORY_LIMIT;
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3869  	}
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3870  
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3871  	if (info->attrs[NL80211_ATTR_TXQ_QUANTUM]) {
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3872  		if (!wiphy_ext_feature_isset(&rdev->wiphy,
f42d22d3f79639 Johannes Berg          2024-11-22  3873  					     NL80211_EXT_FEATURE_TXQS))
f42d22d3f79639 Johannes Berg          2024-11-22  3874  			return -EOPNOTSUPP;
f42d22d3f79639 Johannes Berg          2024-11-22  3875  
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3876  		txq_quantum = nla_get_u32(
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3877  			info->attrs[NL80211_ATTR_TXQ_QUANTUM]);
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3878  		changed |= WIPHY_PARAM_TXQ_QUANTUM;
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3879  	}
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3880  
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3881  	if (changed) {
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3882  		u8 old_retry_short, old_retry_long;
c23c182175594b Roopni Devanathan      2025-01-24  3883  		u32 old_frag_threshold, old_rts_threshold[NL80211_WIPHY_RADIO_ID_MAX];
c23c182175594b Roopni Devanathan      2025-01-24  3884  		u8 old_coverage_class, i;
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3885  		u32 old_txq_limit, old_txq_memory_limit, old_txq_quantum;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3886  
f42d22d3f79639 Johannes Berg          2024-11-22  3887  		if (!rdev->ops->set_wiphy_params)
f42d22d3f79639 Johannes Berg          2024-11-22  3888  			return -EOPNOTSUPP;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3889  
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3890  		old_retry_short = rdev->wiphy.retry_short;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3891  		old_retry_long = rdev->wiphy.retry_long;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3892  		old_frag_threshold = rdev->wiphy.frag_threshold;
c23c182175594b Roopni Devanathan      2025-01-24  3893  		if (radio_id >= rdev->wiphy.n_radio) {
c23c182175594b Roopni Devanathan      2025-01-24  3894  			old_rts_threshold[0] = rdev->wiphy.rts_threshold;
c23c182175594b Roopni Devanathan      2025-01-24  3895  			for (i = 0; i < rdev->wiphy.n_radio; i++)
c23c182175594b Roopni Devanathan      2025-01-24  3896  				old_rts_threshold[i] = rdev->wiphy.radio_cfg[i].rts_threshold;
c23c182175594b Roopni Devanathan      2025-01-24  3897  		} else {
c23c182175594b Roopni Devanathan      2025-01-24  3898  			old_rts_threshold[radio_id] = rdev->wiphy.radio_cfg[radio_id].rts_threshold;
c23c182175594b Roopni Devanathan      2025-01-24  3899  		}
81077e82c3f591 Lukáš Turek            2009-12-21  3900  		old_coverage_class = rdev->wiphy.coverage_class;
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3901  		old_txq_limit = rdev->wiphy.txq_limit;
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3902  		old_txq_memory_limit = rdev->wiphy.txq_memory_limit;
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3903  		old_txq_quantum = rdev->wiphy.txq_quantum;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3904  
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3905  		if (changed & WIPHY_PARAM_RETRY_SHORT)
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3906  			rdev->wiphy.retry_short = retry_short;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3907  		if (changed & WIPHY_PARAM_RETRY_LONG)
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3908  			rdev->wiphy.retry_long = retry_long;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3909  		if (changed & WIPHY_PARAM_FRAG_THRESHOLD)
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3910  			rdev->wiphy.frag_threshold = frag_threshold;
c23c182175594b Roopni Devanathan      2025-01-24  3911  		if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
c23c182175594b Roopni Devanathan      2025-01-24  3912  			if (radio_id >= rdev->wiphy.n_radio) {
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3913  				rdev->wiphy.rts_threshold = rts_threshold;
c23c182175594b Roopni Devanathan      2025-01-24  3914  				for (i = 0; i < rdev->wiphy.n_radio; i++)
c23c182175594b Roopni Devanathan      2025-01-24  3915  					rdev->wiphy.radio_cfg[i].rts_threshold = rts_threshold;
c23c182175594b Roopni Devanathan      2025-01-24  3916  			} else {
c23c182175594b Roopni Devanathan      2025-01-24  3917  				rdev->wiphy.radio_cfg[radio_id].rts_threshold =	rts_threshold;
c23c182175594b Roopni Devanathan      2025-01-24  3918  			}
c23c182175594b Roopni Devanathan      2025-01-24  3919  		}
81077e82c3f591 Lukáš Turek            2009-12-21  3920  		if (changed & WIPHY_PARAM_COVERAGE_CLASS)
81077e82c3f591 Lukáš Turek            2009-12-21  3921  			rdev->wiphy.coverage_class = coverage_class;
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3922  		if (changed & WIPHY_PARAM_TXQ_LIMIT)
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3923  			rdev->wiphy.txq_limit = txq_limit;
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3924  		if (changed & WIPHY_PARAM_TXQ_MEMORY_LIMIT)
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3925  			rdev->wiphy.txq_memory_limit = txq_memory_limit;
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3926  		if (changed & WIPHY_PARAM_TXQ_QUANTUM)
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3927  			rdev->wiphy.txq_quantum = txq_quantum;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3928  
c23c182175594b Roopni Devanathan      2025-01-24  3929  		result = rdev_set_wiphy_params(rdev, radio_id, changed);
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3930  		if (result) {
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3931  			rdev->wiphy.retry_short = old_retry_short;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3932  			rdev->wiphy.retry_long = old_retry_long;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3933  			rdev->wiphy.frag_threshold = old_frag_threshold;
c23c182175594b Roopni Devanathan      2025-01-24  3934  			if (radio_id >= rdev->wiphy.n_radio) {
c23c182175594b Roopni Devanathan      2025-01-24  3935  				rdev->wiphy.rts_threshold = old_rts_threshold[0];
c23c182175594b Roopni Devanathan      2025-01-24  3936  				for (i = 0; i < rdev->wiphy.n_radio; i++)
c23c182175594b Roopni Devanathan      2025-01-24  3937  					rdev->wiphy.radio_cfg[i].rts_threshold = old_rts_threshold[i];
c23c182175594b Roopni Devanathan      2025-01-24  3938  			} else {
c23c182175594b Roopni Devanathan      2025-01-24  3939  				rdev->wiphy.radio_cfg[radio_id].rts_threshold = old_rts_threshold[radio_id];
c23c182175594b Roopni Devanathan      2025-01-24  3940  			}
81077e82c3f591 Lukáš Turek            2009-12-21  3941  			rdev->wiphy.coverage_class = old_coverage_class;
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3942  			rdev->wiphy.txq_limit = old_txq_limit;
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3943  			rdev->wiphy.txq_memory_limit = old_txq_memory_limit;
52539ca89f365d Toke Høiland-Jørgensen 2018-05-08  3944  			rdev->wiphy.txq_quantum = old_txq_quantum;
f42d22d3f79639 Johannes Berg          2024-11-22  3945  			return result;
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3946  		}
b9a5f8cab751d3 Jouni Malinen          2009-04-20  3947  	}
a05829a7222e9d Johannes Berg          2021-01-22  3948  
f42d22d3f79639 Johannes Berg          2024-11-22  3949  	return 0;
556829657397b9 Johannes Berg          2007-09-20  3950  }
556829657397b9 Johannes Berg          2007-09-20  3951  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-01-25 15:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-24 17:17 [PATCH v2 0/5] wifi: cfg80211/mac80211: Set/get wiphy parameters on per-radio basis Roopni Devanathan
2025-01-24 17:17 ` [PATCH v2 1/5] wifi: cfg80211: Add Support to Set RTS Threshold for each Radio Roopni Devanathan
2025-01-25 15:40   ` kernel test robot
2025-01-24 17:17 ` [PATCH v2 2/5] wifi: cfg80211: Report per-radio RTS threshold to userspace Roopni Devanathan
2025-01-24 17:17 ` [PATCH v2 3/5] wifi: mac80211: Set RTS threshold on per-radio basis Roopni Devanathan
2025-01-25 11:49   ` kernel test robot
2025-01-24 17:17 ` [PATCH v2 4/5] wifi: cfg80211: set tx power per radio in a wiphy Roopni Devanathan
2025-01-24 17:17 ` [PATCH v2 5/5] wifi: mac80211: " Roopni Devanathan

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).