2013-04-10 22:12:43

by Tobias Steinicke

[permalink] [raw]
Subject: [RFC] ath9k: Respect current txpower setting

In routine ath_tx_fill_desc(), the txpower is only set to
MAX_RATE_POWER. Now it respects the txpower from bss_conf and set it if it
is (txpower * 2) < MAX_RATE_POWER else set to MAX_RATE_POWER.

Signed-off-by: Tobias Steinicke <[email protected]>
---
drivers/net/wireless/ath/ath9k/xmit.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/xmit.c
b/drivers/net/wireless/ath/ath9k/xmit.c
index 5bc5802..90701e4 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1110,13 +1110,18 @@ static void ath_tx_fill_desc(struct ath_softc
*sc, struct ath_buf *bf,
struct ath_buf *bf_first = bf;
struct ath_tx_info info;
bool aggr = !!(bf->bf_state.bf_type & BUF_AGGR);
+ u8 txpower = tx_info->control.vif->bss_conf.txpower * 2;
memset(&info, 0, sizeof(info));
info.is_first = true;
info.is_last = true;
- info.txpower = MAX_RATE_POWER;
info.qcu = txq->axq_qnum;
+ if (txpower > MAX_RATE_POWER)
+ info.txpower = MAX_RATE_POWER;
+ else
+ info.txpower = txpower;
+
info.flags = ATH9K_TXDESC_INTREQ;
if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK)
info.flags |= ATH9K_TXDESC_NOACK;
--
1.7.9.5



2013-04-10 23:38:27

by Adrian Chadd

[permalink] [raw]
Subject: Re: [RFC] ath9k: Respect current txpower setting

If TPC isn't enabled, the cards transmit at the power configured in
the AR_PHY_TX_POWER_* registers.



Adrian

2013-04-10 23:31:08

by Adrian Chadd

[permalink] [raw]
Subject: Re: [ath9k-devel] [RFC] ath9k: Respect current txpower setting

On 10 April 2013 16:24, Felix Fietkau <[email protected]> wrote:

> I think TPC power value mappings were only problematic in pre-802.11n
> chipsets, all chipsets supported by ath9k should be fine. There may be
> some minor changes missing to enable it on some older chipsets, but
> other than that it should be functional.

.. except AR9285.

.. and I think maybe AR9485, and some of the Osprey era NICs that have
different CCK target power offset values. :-)

It's worth reviewing. I had to do this to get TPC working on AR9285,
and I haven't yet pushed it into FreeBSD (because at the time I didn't
have a spectrum analyser. Now, however, I do..)



Adrian

2013-04-10 23:22:18

by Tobias Steinicke

[permalink] [raw]
Subject: Re: [ath9k-devel] [RFC] ath9k: Respect current txpower setting

I fucked the format. Sorry for that.
I will resend it.

Tobias Steinicke

Am 11.04.2013 00:03, schrieb Tobias Steinicke:
> In routine ath_tx_fill_desc(), the txpower is only set to
> MAX_RATE_POWER. Now it respects the txpower from bss_conf and set it if it
> is (txpower * 2) < MAX_RATE_POWER else set to MAX_RATE_POWER.
>
> Signed-off-by: Tobias Steinicke <[email protected]>
> ---
> drivers/net/wireless/ath/ath9k/xmit.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/xmit.c
> b/drivers/net/wireless/ath/ath9k/xmit.c
> index 5bc5802..90701e4 100644
> --- a/drivers/net/wireless/ath/ath9k/xmit.c
> +++ b/drivers/net/wireless/ath/ath9k/xmit.c
> @@ -1110,13 +1110,18 @@ static void ath_tx_fill_desc(struct ath_softc
> *sc, struct ath_buf *bf,
> struct ath_buf *bf_first = bf;
> struct ath_tx_info info;
> bool aggr = !!(bf->bf_state.bf_type & BUF_AGGR);
> + u8 txpower = tx_info->control.vif->bss_conf.txpower * 2;
> memset(&info, 0, sizeof(info));
> info.is_first = true;
> info.is_last = true;
> - info.txpower = MAX_RATE_POWER;
> info.qcu = txq->axq_qnum;
> + if (txpower > MAX_RATE_POWER)
> + info.txpower = MAX_RATE_POWER;
> + else
> + info.txpower = txpower;
> +
> info.flags = ATH9K_TXDESC_INTREQ;
> if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK)
> info.flags |= ATH9K_TXDESC_NOACK;
>


2013-04-10 23:32:54

by Tobias Steinicke

[permalink] [raw]
Subject: Re: [RFC] ath9k: Respect current txpower setting

Am 11.04.2013 01:20, schrieb Adrian Chadd:
> On 10 April 2013 15:03, Tobias Steinicke
> <[email protected]> wrote:
>> In routine ath_tx_fill_desc(), the txpower is only set to
>> MAX_RATE_POWER. Now it respects the txpower from bss_conf and set it if it
>> is (txpower * 2) < MAX_RATE_POWER else set to MAX_RATE_POWER.
>
> This doesn't do anything unless TPC is enabled.

If I'm understanding this right, if TPC is disable the cards sending always
with the max. power (I guess from the current regdomain)?

Tobias

2013-04-10 23:20:23

by Adrian Chadd

[permalink] [raw]
Subject: Re: [RFC] ath9k: Respect current txpower setting

On 10 April 2013 15:03, Tobias Steinicke
<[email protected]> wrote:
> In routine ath_tx_fill_desc(), the txpower is only set to
> MAX_RATE_POWER. Now it respects the txpower from bss_conf and set it if it
> is (txpower * 2) < MAX_RATE_POWER else set to MAX_RATE_POWER.

This doesn't do anything unless TPC is enabled.

And if TPC is enabled, you have to jump through hoops to set the
correct target TX power, as it's not always 1:1 between dBm value
programmed in and dBm value transmitted.



Adrian

2013-04-10 23:24:06

by Felix Fietkau

[permalink] [raw]
Subject: Re: [ath9k-devel] [RFC] ath9k: Respect current txpower setting

On 2013-04-11 1:20 AM, Adrian Chadd wrote:
> On 10 April 2013 15:03, Tobias Steinicke
> <[email protected]> wrote:
>> In routine ath_tx_fill_desc(), the txpower is only set to
>> MAX_RATE_POWER. Now it respects the txpower from bss_conf and set it if it
>> is (txpower * 2) < MAX_RATE_POWER else set to MAX_RATE_POWER.
>
> This doesn't do anything unless TPC is enabled.
>
> And if TPC is enabled, you have to jump through hoops to set the
> correct target TX power, as it's not always 1:1 between dBm value
> programmed in and dBm value transmitted.
I think TPC power value mappings were only problematic in pre-802.11n
chipsets, all chipsets supported by ath9k should be fine. There may be
some minor changes missing to enable it on some older chipsets, but
other than that it should be functional.

- Felix

2013-04-11 00:04:29

by Tobias Steinicke

[permalink] [raw]
Subject: Re: [RFC] ath9k: Respect current txpower setting

Am 11.04.2013 01:38, schrieb Adrian Chadd:
> If TPC isn't enabled, the cards transmit at the power configured in
> the AR_PHY_TX_POWER_* registers.

I understand. Thanks for the clarification.

But since TPC is enabled, we have to set info.txpower to the
right value. Also ar900[23]_set_txdesc() have to change to apply
info.txpower to all try series.

Tobias