Compare commits

...

1 Commits

Author SHA1 Message Date
Venkat Chimata
a6869bf874 rrmd: Update Tx Power control to use interface instead of wiphy
1. Update TX power control to use interface (dev) instead of wiphy, improving
   compatibility on Wi-Fi 7 platforms.
2. Introduce bssid_to_ifname() helper to reliably map BSSID to interface name.
3. Add a short delay (10 milliseconds) after setting TX power to allow
   driver/firmware state to settle before reading back the value.

Tested on EAP014 and EAP105.

Fixes WIFI-14964

Signed-off-by: Venkat Chimata <venkat@nearhop.com>
2026-01-22 15:12:07 +05:30
3 changed files with 20 additions and 5 deletions

View File

@@ -42,7 +42,12 @@ const actions = {
tx_power: function(msg) {
if (!global.phy.txpower(msg))
return result(1, msg.event, 'BSS ' + msg.bssid + ' failed to set TX power', { action: 'tx_power', bssid: msg.bssid });
// iw dev gives updated value
// But fetching it immediately failed once.
// Could n't reprouce it though
// Give few milliseconds to settle
sleep(10);
let level = global.local.txpower(msg.bssid) / 100;
return result(0, msg.event, 'BSS ' + msg.bssid + ' changed TX power', { action: 'tx_power', bssid: msg.bssid, level });
},

View File

@@ -293,6 +293,15 @@ return {
return -1;
},
bssid_to_ifname: function(bssid) {
for (let bss, v in interfaces) {
if (v.bssid == lc(bssid)) {
return bss;
}
}
return null;
},
txpower: function(bssid) {
for (let bss, v in interfaces) {
if (v.bssid != lc(bssid))

View File

@@ -163,10 +163,11 @@ return {
txpower: function(msg) {
if (!msg.bssid || !msg.level)
return false;
let wiphy = global.local.bssid_to_phy(msg.bssid);
if (wiphy < 0)
return false;
global.nl80211.request(global.nl80211.const.NL80211_CMD_SET_WIPHY, 0, { wiphy, wiphy_tx_power_setting: 2, wiphy_tx_power_level: msg.level * 100});
let dev = global.local.bssid_to_ifname(msg.bssid);
if (dev == null) {
return false;
}
global.nl80211.request(global.nl80211.const.NL80211_CMD_SET_WIPHY, 0, { dev, wiphy_tx_power_setting: 2, wiphy_tx_power_level: msg.level * 100});
return true;
},
};