linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nl80211: Report max TX power in NL80211_BAND_ATTR_FREQS
@ 2008-11-21 17:01 Jouni Malinen
  2008-11-22 17:54 ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Jouni Malinen @ 2008-11-21 17:01 UTC (permalink / raw)
  To: John W. Linville, Johannes Berg; +Cc: linux-wireless

This is useful information to provide for userspace (e.g., hostapd needs
this to generate Country IE).

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>


Index: wireless-testing/include/linux/nl80211.h
===================================================================
--- wireless-testing.orig/include/linux/nl80211.h	2008-11-21 18:35:40.000000000 +0200
+++ wireless-testing/include/linux/nl80211.h	2008-11-21 18:38:10.000000000 +0200
@@ -508,6 +508,7 @@
  *	on this channel in current regulatory domain.
  * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory
  *	on this channel in current regulatory domain.
+ * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in dBm.
  */
 enum nl80211_frequency_attr {
 	__NL80211_FREQUENCY_ATTR_INVALID,
@@ -516,12 +517,15 @@
 	NL80211_FREQUENCY_ATTR_PASSIVE_SCAN,
 	NL80211_FREQUENCY_ATTR_NO_IBSS,
 	NL80211_FREQUENCY_ATTR_RADAR,
+	NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
 
 	/* keep last */
 	__NL80211_FREQUENCY_ATTR_AFTER_LAST,
 	NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1
 };
 
+#define NL80211_FREQUENCY_ATTR_MAX_TX_POWER NL80211_FREQUENCY_ATTR_MAX_TX_POWER
+
 /**
  * enum nl80211_bitrate_attr - bitrate attributes
  * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps
Index: wireless-testing/net/wireless/nl80211.c
===================================================================
--- wireless-testing.orig/net/wireless/nl80211.c	2008-11-21 18:37:10.000000000 +0200
+++ wireless-testing/net/wireless/nl80211.c	2008-11-21 18:37:56.000000000 +0200
@@ -198,6 +198,9 @@
 			if (chan->flags & IEEE80211_CHAN_RADAR)
 				NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_RADAR);
 
+			NLA_PUT_U8(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
+				   chan->max_power);
+
 			nla_nest_end(msg, nl_freq);
 		}
 

-- 
Jouni Malinen                                            PGP id EFC895FA

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

* Re: [PATCH] nl80211: Report max TX power in NL80211_BAND_ATTR_FREQS
  2008-11-21 17:01 [PATCH] nl80211: Report max TX power in NL80211_BAND_ATTR_FREQS Jouni Malinen
@ 2008-11-22 17:54 ` Johannes Berg
  2008-11-22 18:20   ` Jouni Malinen
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2008-11-22 17:54 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: John W. Linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 331 bytes --]

On Fri, 2008-11-21 at 19:01 +0200, Jouni Malinen wrote:
>  
> +			NLA_PUT_U8(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
> +				   chan->max_power);
> +

I think for consistency we should use the same format that the
regulatory stuff has for NL80211_ATTR_POWER_RULE_MAX_EIRP, i.e. a u32
value with mBm (I think)

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH] nl80211: Report max TX power in NL80211_BAND_ATTR_FREQS
  2008-11-22 17:54 ` Johannes Berg
@ 2008-11-22 18:20   ` Jouni Malinen
  2008-11-22 18:26     ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Jouni Malinen @ 2008-11-22 18:20 UTC (permalink / raw)
  To: Johannes Berg; +Cc: John W. Linville, linux-wireless

On Sat, Nov 22, 2008 at 06:54:24PM +0100, Johannes Berg wrote:
> On Fri, 2008-11-21 at 19:01 +0200, Jouni Malinen wrote:
> >  
> > +			NLA_PUT_U8(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
> > +				   chan->max_power);
> > +
> 
> I think for consistency we should use the same format that the
> regulatory stuff has for NL80211_ATTR_POWER_RULE_MAX_EIRP, i.e. a u32
> value with mBm (I think)

Well.. Maximum TX power is stored as dBm and it is used as dBm in
Country IE. Some of the current uses of EIRP seem to be converting the
values between dBm and mBm, so it does not look like the extra accuracy
would be needed there. Why was mBm used in the first place? It does not
seem to be used anywhere outside Linux regulatory code as a standard
unit which makes it quite a bit less obvious than dBm..

I kind of agree with consistency being a good reason for a change here,
but I just find the mBm a bit odd choice as a unit unless there is need
for greater accuracy than 1 dBm (and in that case, the chan->max_power
value should likely be changed to use mBm, too).

-- 
Jouni Malinen                                            PGP id EFC895FA

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

* Re: [PATCH] nl80211: Report max TX power in NL80211_BAND_ATTR_FREQS
  2008-11-22 18:20   ` Jouni Malinen
@ 2008-11-22 18:26     ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2008-11-22 18:26 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: John W. Linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1170 bytes --]

On Sat, 2008-11-22 at 20:20 +0200, Jouni Malinen wrote:

> Well.. Maximum TX power is stored as dBm and it is used as dBm in
> Country IE. Some of the current uses of EIRP seem to be converting the
> values between dBm and mBm, so it does not look like the extra accuracy
> would be needed there. Why was mBm used in the first place? It does not
> seem to be used anywhere outside Linux regulatory code as a standard
> unit which makes it quite a bit less obvious than dBm..

Yeah, true, I think we originally wanted it in the regulatory code and
also push it throughout but then ended up converting it in the kernel.
However, the userspace API is defined with the extra accuracy.

> I kind of agree with consistency being a good reason for a change here,
> but I just find the mBm a bit odd choice as a unit unless there is need
> for greater accuracy than 1 dBm

Broadcom hw at least supports 1/4 dBm steps, iirc. So it could at least
make some sense.

>  (and in that case, the chan->max_power
> value should likely be changed to use mBm, too).

True, but that's in the kernel and much easier to change later than
userspace APIs.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2008-11-22 18:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-21 17:01 [PATCH] nl80211: Report max TX power in NL80211_BAND_ATTR_FREQS Jouni Malinen
2008-11-22 17:54 ` Johannes Berg
2008-11-22 18:20   ` Jouni Malinen
2008-11-22 18:26     ` Johannes Berg

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