nl80211: put current TX power in interface info
PATCH 1/1 nl80211: put current TX power in interface info
Many drivers implement reading current TX power (using either cfg80211 or ieee80211 op) but userspace can't get it using nl80211. Right now the only way to access it is to call some wext ioctl.
Let's put TX power in interface info reply (callback is wdev specific) just like we do with current channel.
To be consistent (e.g. NL80211_CMD_SET_WIPHY) let's use mBm as na unit.
--- net/wireless/nl80211.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
net/wireless/nl80211.c +11 -0
@@ -2403,6 +2403,17 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag } } +if (rdev->ops->get_tx_power) { +int dbm, ret; + + ret =rdev_get_tx_power (rdev, wdev, &dbm); +if (ret ==0 ) { +if (nla_put_u32 (msg,NL80211_ATTR_WIPHY_TX_POWER_LEVEL , +DBM_TO_MBM (dbm))) + goto nla_put_failure; + } + } +if (wdev->ssid_len) {if (nla_put (msg,NL80211_ATTR_SSID , wdev->ssid_len, wdev->ssid)) goto nla_put_failure;
Signature · 1 line
1.8.4.5
Quoted 6 lines · Rafał Miłecki
Many drivers implement reading current TX power (using either cfg80211 or ieee80211 op) but userspace can't get it using nl80211. Right now the only way to access it is to call some wext ioctl.
Let's put TX power in interface info reply (callback is wdev specific) just like we do with current channel.
To be consistent (e.g.NL80211_CMD_SET_WIPHY) let's use mBm as na unit.
An iw patch would be nice as well ;-)
Regards,
Arend
Quoted 28 lines
Signed-off-by Rafał Miłecki <[email protected]>--- net/wireless/nl80211.c | 11 +++++++++++ 1 file changed, 11 insertions(+)net/wireless/nl80211.c +11
-0@@ -2403,6 +2403,17 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag } } +if (rdev->ops->get_tx_power) { +int dbm, ret; + + ret =rdev_get_tx_power (rdev, wdev, &dbm); +if (ret ==0 ) { +if (nla_put_u32 (msg,NL80211_ATTR_WIPHY_TX_POWER_LEVEL , +DBM_TO_MBM (dbm))) + goto nla_put_failure; + } + } +if (wdev->ssid_len) {if (nla_put (msg,NL80211_ATTR_SSID , wdev->ssid_len, wdev->ssid)) goto nla_put_failure;