linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* carl9170: How to control transmit power?
@ 2012-01-11 23:07 Harshal Chhaya
  2012-01-11 23:41 ` Christian Lamparter
  0 siblings, 1 reply; 3+ messages in thread
From: Harshal Chhaya @ 2012-01-11 23:07 UTC (permalink / raw)
  To: linux-wireless

Hello,

Does the carl9170 driver/firmware allow real-time updates to the tx
power parameter?

On my AR9170-based AP, I can't set the tx power using either 'iw' or 'iwconfig'.

'iw' fails with an error message:

root@OpenWrt:/etc/hostapd# iw wlan0 set txpower fixed 10
command failed: Operation not supported (-95)


'iwconfig' seems to update the information that's displayed but it
doesn't affect the actual tx power

root@OpenWrt:/# iwconfig wlan0
wlan0     IEEE 802.11bgn  Mode:Master  Frequency:2.412 GHz  Tx-Power=7 dBm
          RTS thr:off   Fragment thr:off
          Power Management:off

root@OpenWrt:/# iwconfig wlan0 txpower 11

root@OpenWrt:/# iwconfig wlan0
wlan0     IEEE 802.11bgn  Mode:Master  Frequency:2.412 GHz  Tx-Power=11 dBm
          RTS thr:off   Fragment thr:off
          Power Management:off


Is there another way to set the tx power? I want to reduce the range
of my AP and am trying to lower the tx power.

Thanks,
- Harshal

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

* Re: carl9170: How to control transmit power?
  2012-01-11 23:07 carl9170: How to control transmit power? Harshal Chhaya
@ 2012-01-11 23:41 ` Christian Lamparter
  2012-01-18  1:10   ` Harshal Chhaya
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Lamparter @ 2012-01-11 23:41 UTC (permalink / raw)
  To: Harshal Chhaya; +Cc: linux-wireless

On Thursday, January 12, 2012 12:07:54 AM Harshal Chhaya wrote:
> Does the carl9170 driver/firmware allow real-time updates to the tx
> power parameter?

No. not yet. 
 
> On my AR9170-based AP, I can't set the tx power using either 'iw' or 'iwconfig'.
> 
> 'iw' fails with an error message:
> 
> root@OpenWrt:/etc/hostapd# iw wlan0 set txpower fixed 10
> command failed: Operation not supported (-95)

iw uses mBm (millibels referenced to 1 milliwatt) rather than the more familiar dBm.
try: iw wlan0 set txpower fixed 1000
 
> 'iwconfig' seems to update the information that's displayed but it
> doesn't affect the actual tx power
> 
> root@OpenWrt:/# iwconfig wlan0
> wlan0     IEEE 802.11bgn  Mode:Master  Frequency:2.412 GHz  Tx-Power=7 dBm
>           RTS thr:off   Fragment thr:off
>           Power Management:off
> 
> root@OpenWrt:/# iwconfig wlan0 txpower 11
> 
> root@OpenWrt:/# iwconfig wlan0
> wlan0     IEEE 802.11bgn  Mode:Master  Frequency:2.412 GHz  Tx-Power=11 dBm
>           RTS thr:off   Fragment thr:off
>           Power Management:off
> 
> Is there another way to set the tx power? I want to reduce the range
> of my AP and am trying to lower the tx power.

see attached patch. But I have to add that it won't change the
txpower of frames which are generated by the MAC [like RTS/CTS and
(B)ACKS].

Best Regards and good night.
---
diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c
index d19a9ee..771e1a9 100644
--- a/drivers/net/wireless/ath/carl9170/tx.c
+++ b/drivers/net/wireless/ath/carl9170/tx.c
@@ -719,6 +719,8 @@ static void carl9170_tx_rate_tpc_chains(struct ar9170 *ar,
 		else
 			*chains = AR9170_TX_PHY_TXCHAIN_2;
 	}
+
+	*tpc = min_t(unsigned int, *tpc, ar->hw->conf.power_level * 2);
 }
 
 static __le32 carl9170_tx_physet(struct ar9170 *ar,

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

* Re: carl9170: How to control transmit power?
  2012-01-11 23:41 ` Christian Lamparter
@ 2012-01-18  1:10   ` Harshal Chhaya
  0 siblings, 0 replies; 3+ messages in thread
From: Harshal Chhaya @ 2012-01-18  1:10 UTC (permalink / raw)
  To: Christian Lamparter; +Cc: linux-wireless

On Wed, Jan 11, 2012 at 5:41 PM, Christian Lamparter
<chunkeey@googlemail.com> wrote:
> On Thursday, January 12, 2012 12:07:54 AM Harshal Chhaya wrote:
>> Does the carl9170 driver/firmware allow real-time updates to the tx
>> power parameter?
>
> No. not yet.
>
>> On my AR9170-based AP, I can't set the tx power using either 'iw' or 'iwconfig'.
>>
>> 'iw' fails with an error message:
>>
>> root@OpenWrt:/etc/hostapd# iw wlan0 set txpower fixed 10
>> command failed: Operation not supported (-95)
>
> iw uses mBm (millibels referenced to 1 milliwatt) rather than the more familiar dBm.
> try: iw wlan0 set txpower fixed 1000
>
>> 'iwconfig' seems to update the information that's displayed but it
>> doesn't affect the actual tx power
[..]
>> Is there another way to set the tx power? I want to reduce the range
>> of my AP and am trying to lower the tx power.
>
> see attached patch. But I have to add that it won't change the
> txpower of frames which are generated by the MAC [like RTS/CTS and
> (B)ACKS].
>
> Best Regards and good night.
> ---
> diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c
> index d19a9ee..771e1a9 100644
> --- a/drivers/net/wireless/ath/carl9170/tx.c
> +++ b/drivers/net/wireless/ath/carl9170/tx.c
> @@ -719,6 +719,8 @@ static void carl9170_tx_rate_tpc_chains(struct ar9170 *ar,
>                else
>                        *chains = AR9170_TX_PHY_TXCHAIN_2;
>        }
> +
> +       *tpc = min_t(unsigned int, *tpc, ar->hw->conf.power_level * 2);
>  }
>
>  static __le32 carl9170_tx_physet(struct ar9170 *ar,

Christian,

Thank you very much for this patch. I can now use 'iw' to set the
transmit power.

root@OpenWrt:/# iw wlan0 set txpower fixed 1000 	- 	sets it to 10dBm

root@OpenWrt:/# iw wlan0 set txpower fixed 100 	- 	sets it to 1 dBm

And I can see the difference in the transmitted packets.

Do you have a suggestion on how to implement this in an older version
of compat-wireless (specifically
compat-wireless-2011-04-19)?

This is because your beacon IE reordering suggestion from a few months
back (http://marc.info/?l=linux-wireless&m=131643758607833&w=2 )  was
critical in having a usable network.

The tx.c file has changed considerably since then and I can't find the
right place to apply tx power change.

How do I change the carl9170/tx.c file from compat-wireless-2011-04-19
to support tx power control? It doesn't have the
carl9170_tx_rate_tpc_chains() function. But it has a
carl9170_tx_physet() function. Can I do something like

        power = min_t(unsigned int, *tpc, ar->hw->conf.power_level * 2);

in this function after
        power <<= AR9170_TX_PHY_TX_PWR_S;
        power &= AR9170_TX_PHY_TX_PWR;
but before
        tmp |= cpu_to_le32(power);


Alternatively, can you suggest where do I apply your beacon IE
reordering suggestion in a recent (e.g. from 2011-11-15)
compat-wireless release? You had said:

in net/mac80211/tx.c look for the NL80211_IFTYPE_AP case
and move:

	if (beacon->tail)
		memcpy(skb_put(skb, beacon->tail_len),
				beacon->tail, beacon->tail_len);

in front of
	if (local->tim_in_locked_section) {


Thanks again for all your help.

- Harshal

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

end of thread, other threads:[~2012-01-18  1:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11 23:07 carl9170: How to control transmit power? Harshal Chhaya
2012-01-11 23:41 ` Christian Lamparter
2012-01-18  1:10   ` Harshal Chhaya

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