wifi: cfg80211/mac80211: Add support to get radio index

Currently, per-radio attributes are set on per-phy basis, i.e., all the
radios present in a wiphy will take attributes values sent from user. But
each radio in a wiphy can get different values from userspace based on
its requirement.

To extend support to set per-radio attributes, add support to get radio
index from userspace. Add an NL attribute - NL80211_ATTR_WIPHY_RADIO_INDEX,
to get user specified radio index for which attributes should be changed.
Pass this to individual drivers, so that the drivers can use this radio
index to change per-radio attributes when necessary. Currently, per-radio
attributes identified are:
NL80211_ATTR_WIPHY_TX_POWER_LEVEL
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_TXQ_LIMIT
NL80211_ATTR_TXQ_MEMORY_LIMIT
NL80211_ATTR_TXQ_QUANTUM

By default, the radio index is set to -1. This means the attribute should
be treated as a global configuration. If the user has not specified any
index, then the radio index passed to individual drivers would be -1. This
would indicate that the attribute applies to all radios in that wiphy.

Signed-off-by: Roopni Devanathan <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Johannes Berg <[email protected]>
This commit is contained in:
Roopni Devanathan
2025-12-15 16:37:39 +00:00
committed by Felix Fietkau
parent e2a5529fa1
commit 3c232526a0
16 changed files with 53 additions and 35 deletions
+2 -1
View File
@@ -1934,7 +1934,8 @@ void mt76_sw_scan_complete(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
} }
EXPORT_SYMBOL_GPL(mt76_sw_scan_complete); EXPORT_SYMBOL_GPL(mt76_sw_scan_complete);
int mt76_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant) int mt76_get_antenna(struct ieee80211_hw *hw, int radio_idx, u32 *tx_ant,
u32 *rx_ant)
{ {
struct mt76_phy *phy = hw->priv; struct mt76_phy *phy = hw->priv;
struct mt76_dev *dev = phy->dev; struct mt76_dev *dev = phy->dev;
+2 -1
View File
@@ -1598,7 +1598,8 @@ int mt76_get_sar_power(struct mt76_phy *phy,
void mt76_csa_check(struct mt76_dev *dev); void mt76_csa_check(struct mt76_dev *dev);
void mt76_csa_finish(struct mt76_dev *dev); void mt76_csa_finish(struct mt76_dev *dev);
int mt76_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); int mt76_get_antenna(struct ieee80211_hw *hw, int radio_idx, u32 *tx_ant,
u32 *rx_ant);
int mt76_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set); int mt76_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set);
void mt76_insert_ccmp_hdr(struct sk_buff *skb, u8 key_id); void mt76_insert_ccmp_hdr(struct sk_buff *skb, u8 key_id);
int mt76_get_rate(struct mt76_dev *dev, int mt76_get_rate(struct mt76_dev *dev,
+3 -2
View File
@@ -216,7 +216,7 @@ static int mt7603_set_sar_specs(struct ieee80211_hw *hw,
} }
static int static int
mt7603_config(struct ieee80211_hw *hw, u32 changed) mt7603_config(struct ieee80211_hw *hw, int radio_idx, u32 changed)
{ {
struct mt7603_dev *dev = hw->priv; struct mt7603_dev *dev = hw->priv;
int ret = 0; int ret = 0;
@@ -657,7 +657,8 @@ mt7603_sta_rate_tbl_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
} }
static void static void
mt7603_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class) mt7603_set_coverage_class(struct ieee80211_hw *hw, int radio_idx,
s16 coverage_class)
{ {
struct mt7603_dev *dev = hw->priv; struct mt7603_dev *dev = hw->priv;
+7 -4
View File
@@ -420,7 +420,7 @@ static int mt7615_set_sar_specs(struct ieee80211_hw *hw,
return mt76_update_channel(phy->mt76); return mt76_update_channel(phy->mt76);
} }
static int mt7615_config(struct ieee80211_hw *hw, u32 changed) static int mt7615_config(struct ieee80211_hw *hw, int radio_idx, u32 changed)
{ {
struct mt7615_dev *dev = mt7615_hw_dev(hw); struct mt7615_dev *dev = mt7615_hw_dev(hw);
struct mt7615_phy *phy = mt7615_hw_phy(hw); struct mt7615_phy *phy = mt7615_hw_phy(hw);
@@ -784,7 +784,8 @@ static void mt7615_tx(struct ieee80211_hw *hw,
mt76_connac_pm_queue_skb(hw, &dev->pm, wcid, skb); 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, int radio_idx,
u32 val)
{ {
struct mt7615_dev *dev = mt7615_hw_dev(hw); struct mt7615_dev *dev = mt7615_hw_dev(hw);
struct mt7615_phy *phy = mt7615_hw_phy(hw); struct mt7615_phy *phy = mt7615_hw_phy(hw);
@@ -972,7 +973,8 @@ mt7615_offset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
} }
static void static void
mt7615_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class) mt7615_set_coverage_class(struct ieee80211_hw *hw, int radio_idx,
s16 coverage_class)
{ {
struct mt7615_phy *phy = mt7615_hw_phy(hw); struct mt7615_phy *phy = mt7615_hw_phy(hw);
struct mt7615_dev *dev = phy->dev; struct mt7615_dev *dev = phy->dev;
@@ -984,7 +986,8 @@ mt7615_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
} }
static int static int
mt7615_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) mt7615_set_antenna(struct ieee80211_hw *hw, int radio_idx,
u32 tx_ant, u32 rx_ant)
{ {
struct mt7615_dev *dev = mt7615_hw_dev(hw); struct mt7615_dev *dev = mt7615_hw_dev(hw);
struct mt7615_phy *phy = mt7615_hw_phy(hw); struct mt7615_phy *phy = mt7615_hw_phy(hw);
+1 -1
View File
@@ -57,7 +57,7 @@ out:
} }
EXPORT_SYMBOL_GPL(mt76x0_set_sar_specs); EXPORT_SYMBOL_GPL(mt76x0_set_sar_specs);
int mt76x0_config(struct ieee80211_hw *hw, u32 changed) int mt76x0_config(struct ieee80211_hw *hw, int radio_idx, u32 changed)
{ {
struct mt76x02_dev *dev = hw->priv; struct mt76x02_dev *dev = hw->priv;
+1 -1
View File
@@ -48,7 +48,7 @@ void mt76x0_chip_onoff(struct mt76x02_dev *dev, bool enable, bool reset);
void mt76x0_mac_stop(struct mt76x02_dev *dev); void mt76x0_mac_stop(struct mt76x02_dev *dev);
int mt76x0_config(struct ieee80211_hw *hw, u32 changed); int mt76x0_config(struct ieee80211_hw *hw, int radio_idx, u32 changed);
int mt76x0_set_channel(struct mt76_phy *mphy); int mt76x0_set_channel(struct mt76_phy *mphy);
int mt76x0_set_sar_specs(struct ieee80211_hw *hw, int mt76x0_set_sar_specs(struct ieee80211_hw *hw,
const struct cfg80211_sar_specs *sar); const struct cfg80211_sar_specs *sar);
+2 -2
View File
@@ -183,8 +183,8 @@ void mt76x02_wdt_work(struct work_struct *work);
void mt76x02_tx_set_txpwr_auto(struct mt76x02_dev *dev, s8 txpwr); void mt76x02_tx_set_txpwr_auto(struct mt76x02_dev *dev, s8 txpwr);
void mt76x02_set_tx_ackto(struct mt76x02_dev *dev); void mt76x02_set_tx_ackto(struct mt76x02_dev *dev);
void mt76x02_set_coverage_class(struct ieee80211_hw *hw, void mt76x02_set_coverage_class(struct ieee80211_hw *hw,
s16 coverage_class); int radio_idx, s16 coverage_class);
int mt76x02_set_rts_threshold(struct ieee80211_hw *hw, u32 val); int mt76x02_set_rts_threshold(struct ieee80211_hw *hw, int radio_idx, u32 val);
void mt76x02_remove_hdr_pad(struct sk_buff *skb, int len); void mt76x02_remove_hdr_pad(struct sk_buff *skb, int len);
bool mt76x02_tx_status_data(struct mt76_dev *mdev, u8 *update); 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, void mt76x02_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
+2 -2
View File
@@ -548,7 +548,7 @@ void mt76x02_set_tx_ackto(struct mt76x02_dev *dev)
EXPORT_SYMBOL_GPL(mt76x02_set_tx_ackto); EXPORT_SYMBOL_GPL(mt76x02_set_tx_ackto);
void mt76x02_set_coverage_class(struct ieee80211_hw *hw, void mt76x02_set_coverage_class(struct ieee80211_hw *hw,
s16 coverage_class) int radio_idx, s16 coverage_class)
{ {
struct mt76x02_dev *dev = hw->priv; struct mt76x02_dev *dev = hw->priv;
@@ -559,7 +559,7 @@ void mt76x02_set_coverage_class(struct ieee80211_hw *hw,
} }
EXPORT_SYMBOL_GPL(mt76x02_set_coverage_class); 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, int radio_idx, u32 val)
{ {
struct mt76x02_dev *dev = hw->priv; struct mt76x02_dev *dev = hw->priv;
+3 -3
View File
@@ -54,7 +54,7 @@ int mt76x2e_set_channel(struct mt76_phy *phy)
} }
static int static int
mt76x2_config(struct ieee80211_hw *hw, u32 changed) mt76x2_config(struct ieee80211_hw *hw, int radio_idx, u32 changed)
{ {
struct mt76x02_dev *dev = hw->priv; struct mt76x02_dev *dev = hw->priv;
@@ -99,8 +99,8 @@ mt76x2_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
{ {
} }
static int mt76x2_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, static int mt76x2_set_antenna(struct ieee80211_hw *hw, int radio_idx,
u32 rx_ant) u32 tx_ant, u32 rx_ant)
{ {
struct mt76x02_dev *dev = hw->priv; struct mt76x02_dev *dev = hw->priv;
+1 -1
View File
@@ -50,7 +50,7 @@ int mt76x2u_set_channel(struct mt76_phy *mphy)
} }
static int static int
mt76x2u_config(struct ieee80211_hw *hw, u32 changed) mt76x2u_config(struct ieee80211_hw *hw, int radio_idx, u32 changed)
{ {
struct mt76x02_dev *dev = hw->priv; struct mt76x02_dev *dev = hw->priv;
int err = 0; int err = 0;
+8 -5
View File
@@ -449,7 +449,8 @@ out:
return err; return err;
} }
static int mt7915_config(struct ieee80211_hw *hw, u32 changed) static int mt7915_config(struct ieee80211_hw *hw, int radio_idx,
u32 changed)
{ {
struct mt7915_dev *dev = mt7915_hw_dev(hw); struct mt7915_dev *dev = mt7915_hw_dev(hw);
struct mt7915_phy *phy = mt7915_hw_phy(hw); struct mt7915_phy *phy = mt7915_hw_phy(hw);
@@ -913,7 +914,8 @@ static void mt7915_tx(struct ieee80211_hw *hw,
mt76_tx(mphy, control->sta, wcid, skb); 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, int radio_idx,
u32 val)
{ {
struct mt7915_dev *dev = mt7915_hw_dev(hw); struct mt7915_dev *dev = mt7915_hw_dev(hw);
struct mt7915_phy *phy = mt7915_hw_phy(hw); struct mt7915_phy *phy = mt7915_hw_phy(hw);
@@ -1109,7 +1111,8 @@ mt7915_offset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
} }
static void static void
mt7915_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class) mt7915_set_coverage_class(struct ieee80211_hw *hw, int radio_idx,
s16 coverage_class)
{ {
struct mt7915_phy *phy = mt7915_hw_phy(hw); struct mt7915_phy *phy = mt7915_hw_phy(hw);
struct mt7915_dev *dev = phy->dev; struct mt7915_dev *dev = phy->dev;
@@ -1121,7 +1124,7 @@ mt7915_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
} }
static int static int
mt7915_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) mt7915_set_antenna(struct ieee80211_hw *hw, int radio_idx, u32 tx_ant, u32 rx_ant)
{ {
struct mt7915_dev *dev = mt7915_hw_dev(hw); struct mt7915_dev *dev = mt7915_hw_dev(hw);
struct mt7915_phy *phy = mt7915_hw_phy(hw); struct mt7915_phy *phy = mt7915_hw_phy(hw);
@@ -1699,7 +1702,7 @@ mt7915_twt_teardown_request(struct ieee80211_hw *hw,
} }
static int static int
mt7915_set_frag_threshold(struct ieee80211_hw *hw, u32 val) mt7915_set_frag_threshold(struct ieee80211_hw *hw, int radio_idx, u32 val)
{ {
return 0; return 0;
} }
+5 -3
View File
@@ -626,7 +626,7 @@ void mt7921_set_runtime_pm(struct mt792x_dev *dev)
mt76_connac_mcu_set_deep_sleep(&dev->mt76, pm->ds_enable); mt76_connac_mcu_set_deep_sleep(&dev->mt76, pm->ds_enable);
} }
static int mt7921_config(struct ieee80211_hw *hw, u32 changed) static int mt7921_config(struct ieee80211_hw *hw, int radio_idx, u32 changed)
{ {
struct mt792x_dev *dev = mt792x_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt792x_phy *phy = mt792x_hw_phy(hw); struct mt792x_phy *phy = mt792x_hw_phy(hw);
@@ -915,7 +915,8 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
} }
EXPORT_SYMBOL_GPL(mt7921_mac_sta_remove); 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, int radio_idx,
u32 val)
{ {
struct mt792x_dev *dev = mt792x_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
@@ -1096,7 +1097,8 @@ mt7921_stop_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
} }
static int static int
mt7921_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) mt7921_set_antenna(struct ieee80211_hw *hw, int radio_idx,
u32 tx_ant, u32 rx_ant)
{ {
struct mt792x_dev *dev = mt792x_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt792x_phy *phy = mt792x_hw_phy(hw); struct mt792x_phy *phy = mt792x_hw_phy(hw);
+5 -3
View File
@@ -758,7 +758,7 @@ void mt7925_set_runtime_pm(struct mt792x_dev *dev)
mt7925_mcu_set_deep_sleep(dev, pm->ds_enable); mt7925_mcu_set_deep_sleep(dev, pm->ds_enable);
} }
static int mt7925_config(struct ieee80211_hw *hw, u32 changed) static int mt7925_config(struct ieee80211_hw *hw, int radio_idx, u32 changed)
{ {
struct mt792x_dev *dev = mt792x_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
int ret = 0; int ret = 0;
@@ -1219,7 +1219,8 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
} }
EXPORT_SYMBOL_GPL(mt7925_mac_sta_remove); 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, int radio_idx,
u32 val)
{ {
struct mt792x_dev *dev = mt792x_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
@@ -1438,7 +1439,8 @@ mt7925_stop_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
} }
static int static int
mt7925_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) mt7925_set_antenna(struct ieee80211_hw *hw, int radio_idx,
u32 tx_ant, u32 rx_ant)
{ {
struct mt792x_dev *dev = mt792x_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt792x_phy *phy = mt792x_hw_phy(hw); struct mt792x_phy *phy = mt792x_hw_phy(hw);
+2 -1
View File
@@ -413,7 +413,8 @@ void mt792x_sta_statistics(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, struct ieee80211_sta *sta,
struct station_info *sinfo); struct station_info *sinfo);
void mt792x_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class); void mt792x_set_coverage_class(struct ieee80211_hw *hw, int radio_idx,
s16 coverage_class);
void mt792x_dma_cleanup(struct mt792x_dev *dev); void mt792x_dma_cleanup(struct mt792x_dev *dev);
int mt792x_dma_enable(struct mt792x_dev *dev); int mt792x_dma_enable(struct mt792x_dev *dev);
int mt792x_wpdma_reset(struct mt792x_dev *dev, bool force); int mt792x_wpdma_reset(struct mt792x_dev *dev, bool force);
+2 -1
View File
@@ -601,7 +601,8 @@ void mt792x_sta_statistics(struct ieee80211_hw *hw,
} }
EXPORT_SYMBOL_GPL(mt792x_sta_statistics); EXPORT_SYMBOL_GPL(mt792x_sta_statistics);
void mt792x_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class) void mt792x_set_coverage_class(struct ieee80211_hw *hw, int radio_idx,
s16 coverage_class)
{ {
struct mt792x_phy *phy = mt792x_hw_phy(hw); struct mt792x_phy *phy = mt792x_hw_phy(hw);
struct mt792x_dev *dev = phy->dev; struct mt792x_dev *dev = phy->dev;
+7 -4
View File
@@ -647,7 +647,7 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
return err; return err;
} }
static int mt7996_config(struct ieee80211_hw *hw, u32 changed) static int mt7996_config(struct ieee80211_hw *hw, int radio_idx, u32 changed)
{ {
return 0; return 0;
} }
@@ -1378,7 +1378,8 @@ unlock:
rcu_read_unlock(); rcu_read_unlock();
} }
static int mt7996_set_rts_threshold(struct ieee80211_hw *hw, u32 val) static int mt7996_set_rts_threshold(struct ieee80211_hw *hw, int radio_idx,
u32 val)
{ {
struct mt7996_dev *dev = mt7996_hw_dev(hw); struct mt7996_dev *dev = mt7996_hw_dev(hw);
int i, ret = 0; int i, ret = 0;
@@ -1598,7 +1599,8 @@ unlock:
} }
static void static void
mt7996_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class) mt7996_set_coverage_class(struct ieee80211_hw *hw, int radio_idx,
s16 coverage_class)
{ {
struct mt7996_dev *dev = mt7996_hw_dev(hw); struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_phy *phy; struct mt7996_phy *phy;
@@ -1612,7 +1614,8 @@ mt7996_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
} }
static int static int
mt7996_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) mt7996_set_antenna(struct ieee80211_hw *hw, int radio_idx,
u32 tx_ant, u32 rx_ant)
{ {
struct mt7996_dev *dev = mt7996_hw_dev(hw); struct mt7996_dev *dev = mt7996_hw_dev(hw);
int i; int i;