* [PATCH] nl80211: Provide per channel maximum regulatory transmit power
@ 2013-10-02 7:43 Helmut Schaa
2013-10-02 8:44 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Helmut Schaa @ 2013-10-02 7:43 UTC (permalink / raw)
To: johannes; +Cc: linux-wireless, Helmut Schaa
In some cases its not only required to know the maximum transmit power
the hw is capable of. Instead, userspace (hostapd) might want to know
the maximum transmit power as defined in the current regulatory domain
(for example for 802.11d country IEs).
Hence, provide that information to user space via nl80211.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
---
include/uapi/linux/nl80211.h | 3 +++
net/wireless/nl80211.c | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index fde2c02..6130278 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2230,6 +2230,8 @@ enum nl80211_band_attr {
* isn't possible
* @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
* currently defined
+ * @NL80211_FREQUENCY_ATTR_MAX_REG_TX_POWER: Maximum regulatory transmission
+ * power in mBm (100 * dBm).
* @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
*/
enum nl80211_frequency_attr {
@@ -2246,6 +2248,7 @@ enum nl80211_frequency_attr {
NL80211_FREQUENCY_ATTR_NO_HT40_PLUS,
NL80211_FREQUENCY_ATTR_NO_80MHZ,
NL80211_FREQUENCY_ATTR_NO_160MHZ,
+ NL80211_FREQUENCY_ATTR_MAX_REG_TX_POWER,
/* keep last */
__NL80211_FREQUENCY_ATTR_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 626dc3b..7c22355 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -584,6 +584,10 @@ static int nl80211_msg_put_channel(struct sk_buff *msg,
DBM_TO_MBM(chan->max_power)))
goto nla_put_failure;
+ if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_REG_TX_POWER,
+ DBM_TO_MBM(chan->max_reg_power)))
+ goto nla_put_failure;
+
return 0;
nla_put_failure:
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] nl80211: Provide per channel maximum regulatory transmit power
2013-10-02 7:43 [PATCH] nl80211: Provide per channel maximum regulatory transmit power Helmut Schaa
@ 2013-10-02 8:44 ` Johannes Berg
2013-10-02 9:04 ` Helmut Schaa
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2013-10-02 8:44 UTC (permalink / raw)
To: Helmut Schaa; +Cc: linux-wireless
On Wed, 2013-10-02 at 09:43 +0200, Helmut Schaa wrote:
> In some cases its not only required to know the maximum transmit power
> the hw is capable of. Instead, userspace (hostapd) might want to know
> the maximum transmit power as defined in the current regulatory domain
> (for example for 802.11d country IEs).
Why wouldn't it use (the equivalent of) "iw reg get" for that?
> + if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_REG_TX_POWER,
> + DBM_TO_MBM(chan->max_reg_power)))
> + goto nla_put_failure;
This would have to go into the "if (large)" part because otherwise older
userspace can't read the info at all since it overflows the buffer.
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nl80211: Provide per channel maximum regulatory transmit power
2013-10-02 8:44 ` Johannes Berg
@ 2013-10-02 9:04 ` Helmut Schaa
0 siblings, 0 replies; 3+ messages in thread
From: Helmut Schaa @ 2013-10-02 9:04 UTC (permalink / raw)
To: Johannes Berg, Jouni Malinen; +Cc: linux-wireless
On Wed, Oct 2, 2013 at 10:44 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Wed, 2013-10-02 at 09:43 +0200, Helmut Schaa wrote:
>> In some cases its not only required to know the maximum transmit power
>> the hw is capable of. Instead, userspace (hostapd) might want to know
>> the maximum transmit power as defined in the current regulatory domain
>> (for example for 802.11d country IEs).
>
> Why wouldn't it use (the equivalent of) "iw reg get" for that?
Might be the more sane approach.
I noticed that hostapd generates 11d IEs based on the channel list it
reads from the kernel.
Thus restricting STAs to the max tx power the hw is capable of. Just
adding the max regulatory
tx power looked like an easy solution :)
Jouni, would you be ok with using the kernels regulatory domain for
11d IEs in hostapd?
Thanks,
Helmut
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-02 9:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-02 7:43 [PATCH] nl80211: Provide per channel maximum regulatory transmit power Helmut Schaa
2013-10-02 8:44 ` Johannes Berg
2013-10-02 9:04 ` Helmut Schaa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox