2014-12-27 14:12:29

by Lorenzo Bianconi

[permalink] [raw]
Subject: [RFC 0/3] add TPC capability for AR9002 based chips

This patchset adds TPC capability to ath9k for AR9002 based chips

*[RFC 1/3]: add TX power per-rate tables to cap TX power in TX descriptor path
*[RFC 2/3]: cap per-packet TX power according to TX power per-rate tables
*[RFC 3/3]: enable per-packet TPC on AR9002 based chips by default

This pachset is based on Adrian Chadd's hints
(https://www.mail-archive.com/[email protected]/msg10396.html)

Lorenzo Bianconi (3):
ath9k: add power per-rate tables for AR9002 chips
ath9k: add TPC to TX path for AR9002 based chips
ath9k: enable per-packet TPC on AR9002 based chips

drivers/net/wireless/ath/ath9k/ar5008_phy.c | 80 ++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath9k/debug.c | 5 --
drivers/net/wireless/ath/ath9k/eeprom_4k.c | 14 +++++
drivers/net/wireless/ath/ath9k/eeprom_9287.c | 15 ++++++
drivers/net/wireless/ath/ath9k/eeprom_def.c | 14 +++++
drivers/net/wireless/ath/ath9k/hw.c | 3 +-
drivers/net/wireless/ath/ath9k/hw.h | 2 +
drivers/net/wireless/ath/ath9k/xmit.c | 66 +++++++++++++++++++----
8 files changed, 181 insertions(+), 18 deletions(-)

--
2.1.0



2014-12-27 14:12:32

by Lorenzo Bianconi

[permalink] [raw]
Subject: [RFC 2/3] ath9k: add TPC to TX path for AR9002 based chips

Add TPC capability to TX descriptor path for AR9002 based chips. Scale
per-packet TX power according to eeprom power bias, power adjustments for
HT40 mode and open loop CCK rates. Cap per-packet TX power according to
TX power per-rate tables

Signed-off-by: Lorenzo Bianconi <[email protected]>
---
drivers/net/wireless/ath/ath9k/xmit.c | 66 +++++++++++++++++++++++++++++------
1 file changed, 55 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 52d63de..1cfe5f8 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1097,24 +1097,65 @@ void ath_update_max_aggr_framelen(struct ath_softc *sc, int queue, int txop)
}

static u8 ath_get_rate_txpower(struct ath_softc *sc, struct ath_buf *bf,
- u8 rateidx)
+ u8 rateidx, bool is_40, bool is_cck)
{
u8 max_power;
+ struct sk_buff *skb;
+ struct ath_frame_info *fi;
+ struct ieee80211_tx_info *info;
struct ath_hw *ah = sc->sc_ah;

if (sc->tx99_state)
return MAX_RATE_POWER;

+ skb = bf->bf_mpdu;
+ fi = get_frame_info(skb);
+ info = IEEE80211_SKB_CB(skb);
+
if (!AR_SREV_9300_20_OR_LATER(ah)) {
- /* ar9002 does not support TPC for the moment */
- return MAX_RATE_POWER;
- }
+ int txpower = fi->tx_power;

- if (!bf->bf_state.bfs_paprd) {
- struct sk_buff *skb = bf->bf_mpdu;
- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
- struct ath_frame_info *fi = get_frame_info(skb);
+ if (is_40) {
+ u8 power_ht40delta;
+ struct ar5416_eeprom_def *eep = &ah->eeprom.def;
+
+ if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_2) {
+ bool is_2ghz;
+ struct modal_eep_header *pmodal;

+ is_2ghz = info->band == IEEE80211_BAND_2GHZ;
+ pmodal = &eep->modalHeader[is_2ghz];
+ power_ht40delta = pmodal->ht40PowerIncForPdadc;
+ } else {
+ power_ht40delta = 2;
+ }
+ txpower += power_ht40delta;
+ }
+
+ if (AR_SREV_9287(ah) || AR_SREV_9285(ah) ||
+ AR_SREV_9271(ah)) {
+ txpower -= 2 * AR9287_PWR_TABLE_OFFSET_DB;
+ } else if (AR_SREV_9280_20_OR_LATER(ah)) {
+ s8 power_offset;
+
+ power_offset = ah->eep_ops->get_eeprom(ah,
+ EEP_PWR_TABLE_OFFSET);
+ txpower -= 2 * power_offset;
+ }
+
+ if (OLC_FOR_AR9280_20_LATER && is_cck)
+ txpower -= 2;
+
+ txpower = max(txpower, 0);
+ max_power = min_t(ah->tx_power[rateidx], (u8)txpower);
+
+ /* XXX: clamp minimum TX power at 1 for AR9160 since if
+ * max_power is set to 0, frames are transmitted at max
+ * TX power
+ */
+ if (!max_power && !AR_SREV_9280_20_OR_LATER(ah))
+ max_power = 1;
+ } else if (!bf->bf_state.bfs_paprd) {
if (rateidx < 8 && (info->flags & IEEE80211_TX_CTL_STBC))
max_power = min(ah->tx_power_stbc[rateidx],
fi->tx_power);
@@ -1152,7 +1193,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf,
info->rtscts_rate = fi->rtscts_rate;

for (i = 0; i < ARRAY_SIZE(bf->rates); i++) {
- bool is_40, is_sgi, is_sp;
+ bool is_40, is_sgi, is_sp, is_cck;
int phy;

if (!rates[i].count || (rates[i].idx < 0))
@@ -1198,7 +1239,8 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf,
if (rix < 8 && (tx_info->flags & IEEE80211_TX_CTL_STBC))
info->rates[i].RateFlags |= ATH9K_RATESERIES_STBC;

- info->txpower[i] = ath_get_rate_txpower(sc, bf, rix);
+ info->txpower[i] = ath_get_rate_txpower(sc, bf, rix,
+ is_40, false);
continue;
}

@@ -1227,7 +1269,9 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf,
info->rates[i].PktDuration = ath9k_hw_computetxtime(sc->sc_ah,
phy, rate->bitrate * 100, len, rix, is_sp);

- info->txpower[i] = ath_get_rate_txpower(sc, bf, rix);
+ is_cck = IS_CCK_RATE(info->rates[i].Rate);
+ info->txpower[i] = ath_get_rate_txpower(sc, bf, rix, false,
+ is_cck);
}

/* For AR5416 - RTS cannot be followed by a frame larger than 8K */
--
2.1.0


2014-12-27 14:12:30

by Lorenzo Bianconi

[permalink] [raw]
Subject: [RFC 1/3] ath9k: add power per-rate tables for AR9002 chips

Add TX power per-rate tables for MIMO/legacy modes for AR9002 based chips
in order to cap the maximum TX power value per-rate in the TX descriptor path.
Add TX power adjustments for HT40 mode, open loop CCK rates and eeprom power
bias for AR9280 and later chips

Signed-off-by: Lorenzo Bianconi <[email protected]>
---
drivers/net/wireless/ath/ath9k/ar5008_phy.c | 80 ++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath9k/eeprom_4k.c | 14 +++++
drivers/net/wireless/ath/ath9k/eeprom_9287.c | 15 ++++++
drivers/net/wireless/ath/ath9k/eeprom_def.c | 14 +++++
drivers/net/wireless/ath/ath9k/hw.h | 2 +
5 files changed, 125 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
index 5829074..f273427 100644
--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
@@ -22,6 +22,21 @@

/* All code below is for AR5008, AR9001, AR9002 */

+#define AR5008_OFDM_RATES 8
+#define AR5008_HT_SS_RATES 8
+#define AR5008_HT_DS_RATES 8
+
+#define AR5008_HT20_SHIFT 16
+#define AR5008_HT40_SHIFT 24
+
+#define AR5008_11NA_OFDM_SHIFT 0
+#define AR5008_11NA_HT_SS_SHIFT 8
+#define AR5008_11NA_HT_DS_SHIFT 16
+
+#define AR5008_11NG_OFDM_SHIFT 4
+#define AR5008_11NG_HT_SS_SHIFT 12
+#define AR5008_11NG_HT_DS_SHIFT 20
+
static const int firstep_table[] =
/* level: 0 1 2 3 4 5 6 7 8 */
{ -4, -2, 0, 2, 4, 6, 8, 10, 12 }; /* lvl 0-8, default 2 */
@@ -1235,6 +1250,71 @@ static void ar5008_hw_set_radar_conf(struct ath_hw *ah)
conf->radar_inband = 8;
}

+static void ar5008_hw_init_txpower_cck(struct ath_hw *ah, int16_t *rate_array)
+{
+#define CCK_DELTA(x) ((OLC_FOR_AR9280_20_LATER) ? max((x) - 2, 0) : (x))
+ ah->tx_power[0] = CCK_DELTA(rate_array[rate1l]);
+ ah->tx_power[1] = CCK_DELTA(min(rate_array[rate2l],
+ rate_array[rate2s]));
+ ah->tx_power[2] = CCK_DELTA(min(rate_array[rate5_5l],
+ rate_array[rate5_5s]));
+ ah->tx_power[3] = CCK_DELTA(min(rate_array[rate11l],
+ rate_array[rate11s]));
+#undef CCK_DELTA
+}
+
+static void ar5008_hw_init_txpower_ofdm(struct ath_hw *ah, int16_t *rate_array,
+ int offset)
+{
+ int i, idx = 0;
+
+ for (i = offset; i < offset + AR5008_OFDM_RATES; i++) {
+ ah->tx_power[i] = rate_array[idx];
+ idx++;
+ }
+}
+
+static void ar5008_hw_init_txpower_ht(struct ath_hw *ah, int16_t *rate_array,
+ int ss_offset, int ds_offset,
+ bool is_40, int ht40_delta)
+{
+ int i, mcs_idx = (is_40) ? AR5008_HT40_SHIFT : AR5008_HT20_SHIFT;
+
+ for (i = ss_offset; i < ss_offset + AR5008_HT_SS_RATES; i++) {
+ ah->tx_power[i] = rate_array[mcs_idx] + ht40_delta;
+ mcs_idx++;
+ }
+ memcpy(&ah->tx_power[ds_offset], &ah->tx_power[ss_offset],
+ AR5008_HT_SS_RATES);
+}
+
+void ar5008_hw_init_rate_txpower(struct ath_hw *ah, int16_t *rate_array,
+ struct ath9k_channel *chan, int ht40_delta)
+{
+ if (IS_CHAN_5GHZ(chan)) {
+ ar5008_hw_init_txpower_ofdm(ah, rate_array,
+ AR5008_11NA_OFDM_SHIFT);
+ if (IS_CHAN_HT20(chan) || IS_CHAN_HT40(chan)) {
+ ar5008_hw_init_txpower_ht(ah, rate_array,
+ AR5008_11NA_HT_SS_SHIFT,
+ AR5008_11NA_HT_DS_SHIFT,
+ IS_CHAN_HT40(chan),
+ ht40_delta);
+ }
+ } else {
+ ar5008_hw_init_txpower_cck(ah, rate_array);
+ ar5008_hw_init_txpower_ofdm(ah, rate_array,
+ AR5008_11NG_OFDM_SHIFT);
+ if (IS_CHAN_HT20(chan) || IS_CHAN_HT40(chan)) {
+ ar5008_hw_init_txpower_ht(ah, rate_array,
+ AR5008_11NG_HT_SS_SHIFT,
+ AR5008_11NG_HT_DS_SHIFT,
+ IS_CHAN_HT40(chan),
+ ht40_delta);
+ }
+ }
+}
+
int ar5008_hw_attach_phy_ops(struct ath_hw *ah)
{
struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
index 07b806c..e5a78d4 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
@@ -748,6 +748,20 @@ static void ath9k_hw_4k_set_txpower(struct ath_hw *ah,
| ATH9K_POW_SM(ratesArray[rateDupCck], 0));
}

+ /* TPC initializations */
+ if (ah->tpc_enabled) {
+ int ht40_delta;
+
+ ht40_delta = (IS_CHAN_HT40(chan)) ? ht40PowerIncForPdadc : 0;
+ ar5008_hw_init_rate_txpower(ah, ratesArray, chan, ht40_delta);
+ /* Enable TPC */
+ REG_WRITE(ah, AR_PHY_POWER_TX_RATE_MAX,
+ MAX_RATE_POWER | AR_PHY_POWER_TX_RATE_MAX_TPC_ENABLE);
+ } else {
+ /* Disable TPC */
+ REG_WRITE(ah, AR_PHY_POWER_TX_RATE_MAX, MAX_RATE_POWER);
+ }
+
REGWRITE_BUFFER_FLUSH(ah);
}

diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
index 5ba1385..6ca33df 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
@@ -886,6 +886,21 @@ static void ath9k_hw_ar9287_set_txpower(struct ath_hw *ah,
| ATH9K_POW_SM(ratesArray[rateDupOfdm], 8)
| ATH9K_POW_SM(ratesArray[rateDupCck], 0));
}
+
+ /* TPC initializations */
+ if (ah->tpc_enabled) {
+ int ht40_delta;
+
+ ht40_delta = (IS_CHAN_HT40(chan)) ? ht40PowerIncForPdadc : 0;
+ ar5008_hw_init_rate_txpower(ah, ratesArray, chan, ht40_delta);
+ /* Enable TPC */
+ REG_WRITE(ah, AR_PHY_POWER_TX_RATE_MAX,
+ MAX_RATE_POWER | AR_PHY_POWER_TX_RATE_MAX_TPC_ENABLE);
+ } else {
+ /* Disable TPC */
+ REG_WRITE(ah, AR_PHY_POWER_TX_RATE_MAX, MAX_RATE_POWER);
+ }
+
REGWRITE_BUFFER_FLUSH(ah);
}

diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c
index 122b846..0980590 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
@@ -1332,6 +1332,20 @@ static void ath9k_hw_def_set_txpower(struct ath_hw *ah,
ATH9K_POW_SM(pModal->pwrDecreaseFor3Chain, 6)
| ATH9K_POW_SM(pModal->pwrDecreaseFor2Chain, 0));

+ /* TPC initializations */
+ if (ah->tpc_enabled) {
+ int ht40_delta;
+
+ ht40_delta = (IS_CHAN_HT40(chan)) ? ht40PowerIncForPdadc : 0;
+ ar5008_hw_init_rate_txpower(ah, ratesArray, chan, ht40_delta);
+ /* Enable TPC */
+ REG_WRITE(ah, AR_PHY_POWER_TX_RATE_MAX,
+ MAX_RATE_POWER | AR_PHY_POWER_TX_RATE_MAX_TPC_ENABLE);
+ } else {
+ /* Disable TPC */
+ REG_WRITE(ah, AR_PHY_POWER_TX_RATE_MAX, MAX_RATE_POWER);
+ }
+
REGWRITE_BUFFER_FLUSH(ah);
}

diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 1cbd335..69a1222 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -1086,6 +1086,8 @@ bool ar9003_is_paprd_enabled(struct ath_hw *ah);
void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx);
void ar9003_hw_init_rate_txpower(struct ath_hw *ah, u8 *rate_array,
struct ath9k_channel *chan);
+void ar5008_hw_init_rate_txpower(struct ath_hw *ah, int16_t *rate_array,
+ struct ath9k_channel *chan, int ht40_delta);

/* Hardware family op attach helpers */
int ar5008_hw_attach_phy_ops(struct ath_hw *ah);
--
2.1.0


2014-12-28 12:46:25

by Oleksij Rempel

[permalink] [raw]
Subject: Re: [RFC 0/3] add TPC capability for AR9002 based chips

Hi, can you please describe some testcases for you patches.

Am 27.12.2014 um 15:12 schrieb Lorenzo Bianconi:
> This patchset adds TPC capability to ath9k for AR9002 based chips
>
> *[RFC 1/3]: add TX power per-rate tables to cap TX power in TX descriptor path
> *[RFC 2/3]: cap per-packet TX power according to TX power per-rate tables
> *[RFC 3/3]: enable per-packet TPC on AR9002 based chips by default
>
> This pachset is based on Adrian Chadd's hints
> (https://www.mail-archive.com/[email protected]/msg10396.html)
>
> Lorenzo Bianconi (3):
> ath9k: add power per-rate tables for AR9002 chips
> ath9k: add TPC to TX path for AR9002 based chips
> ath9k: enable per-packet TPC on AR9002 based chips
>
> drivers/net/wireless/ath/ath9k/ar5008_phy.c | 80 ++++++++++++++++++++++++++++
> drivers/net/wireless/ath/ath9k/debug.c | 5 --
> drivers/net/wireless/ath/ath9k/eeprom_4k.c | 14 +++++
> drivers/net/wireless/ath/ath9k/eeprom_9287.c | 15 ++++++
> drivers/net/wireless/ath/ath9k/eeprom_def.c | 14 +++++
> drivers/net/wireless/ath/ath9k/hw.c | 3 +-
> drivers/net/wireless/ath/ath9k/hw.h | 2 +
> drivers/net/wireless/ath/ath9k/xmit.c | 66 +++++++++++++++++++----
> 8 files changed, 181 insertions(+), 18 deletions(-)
>


--
Regards,
Oleksij


Attachments:
signature.asc (213.00 B)
OpenPGP digital signature

2014-12-30 11:00:42

by Lorenzo Bianconi

[permalink] [raw]
Subject: Re: [RFC 0/3] add TPC capability for AR9002 based chips

> Am 29.12.2014 um 15:18 schrieb Lorenzo Bianconi:
>>> Am 28.12.2014 um 15:32 schrieb Lorenzo Bianconi:
>>>>> Hi, can you please describe some testcases for you patches.
>>>>>
>>>>
>>>> This patchset adds Transmission Power Control (TPC) for AR9002 based
>>>> chips. IOW it enables the capability of correct TX power on per-packet
>>>> basis. It is preparatory for upcoming Thomas's joint rate and power
>>>> control
>>>> algorithm.
>>>
>>> Do you mean, right now there is no way to test your patches?
>>>
>>
>> I have just added TPC support to ath9k. In order to exploit that hw
>> feature we have to wait Thomas's algorithm :).
>> However in order to test patches you can set tx_power field of
>> ath_frame_info data structure in setup_frame_info() to a different
>> value (for the moment it is set to MAX_RATE_POWER) and measure the RX
>> power on the other end of the link (this is what I did).
>
> Ok, thank you.
> We will talk with Adrian how to mesure it at home.
>

You can get a raw measure of received signal strenght from radiotap
header of sniffed frames on RX side.

Regards,
Lorenzo

>>
>> Regards,
>> Lorenzo
>>
>>>
>>>> Regards,
>>>> Lorenzo
>>>>
>>>>> Am 27.12.2014 um 15:12 schrieb Lorenzo Bianconi:
>>>>>> This patchset adds TPC capability to ath9k for AR9002 based chips
>>>>>>
>>>>>> *[RFC 1/3]: add TX power per-rate tables to cap TX power in TX descriptor path
>>>>>> *[RFC 2/3]: cap per-packet TX power according to TX power per-rate tables
>>>>>> *[RFC 3/3]: enable per-packet TPC on AR9002 based chips by default
>>>>>>
>>>>>> This pachset is based on Adrian Chadd's hints
>>>>>> (https://www.mail-archive.com/[email protected]/msg10396.html)
>>>>>>
>>>>>> Lorenzo Bianconi (3):
>>>>>> ath9k: add power per-rate tables for AR9002 chips
>>>>>> ath9k: add TPC to TX path for AR9002 based chips
>>>>>> ath9k: enable per-packet TPC on AR9002 based chips
>>>>>>
>>>>>> drivers/net/wireless/ath/ath9k/ar5008_phy.c | 80 ++++++++++++++++++++++++++++
>>>>>> drivers/net/wireless/ath/ath9k/debug.c | 5 --
>>>>>> drivers/net/wireless/ath/ath9k/eeprom_4k.c | 14 +++++
>>>>>> drivers/net/wireless/ath/ath9k/eeprom_9287.c | 15 ++++++
>>>>>> drivers/net/wireless/ath/ath9k/eeprom_def.c | 14 +++++
>>>>>> drivers/net/wireless/ath/ath9k/hw.c | 3 +-
>>>>>> drivers/net/wireless/ath/ath9k/hw.h | 2 +
>>>>>> drivers/net/wireless/ath/ath9k/xmit.c | 66 +++++++++++++++++++----
>>>>>> 8 files changed, 181 insertions(+), 18 deletions(-)
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Regards,
>>>>> Oleksij
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Regards,
>>> Oleksij
>>>
>>
>>
>>
>
>
> --
> Regards,
> Oleksij
>



--
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep

2014-12-28 14:32:19

by Lorenzo Bianconi

[permalink] [raw]
Subject: Re: [RFC 0/3] add TPC capability for AR9002 based chips

> Hi, can you please describe some testcases for you patches.
>

This patchset adds Transmission Power Control (TPC) for AR9002 based
chips. IOW it enables the capability of correct TX power on per-packet
basis. It is preparatory for upcoming Thomas's joint rate and power
control
algorithm.

Regards,
Lorenzo

> Am 27.12.2014 um 15:12 schrieb Lorenzo Bianconi:
>> This patchset adds TPC capability to ath9k for AR9002 based chips
>>
>> *[RFC 1/3]: add TX power per-rate tables to cap TX power in TX descriptor path
>> *[RFC 2/3]: cap per-packet TX power according to TX power per-rate tables
>> *[RFC 3/3]: enable per-packet TPC on AR9002 based chips by default
>>
>> This pachset is based on Adrian Chadd's hints
>> (https://www.mail-archive.com/[email protected]/msg10396.html)
>>
>> Lorenzo Bianconi (3):
>> ath9k: add power per-rate tables for AR9002 chips
>> ath9k: add TPC to TX path for AR9002 based chips
>> ath9k: enable per-packet TPC on AR9002 based chips
>>
>> drivers/net/wireless/ath/ath9k/ar5008_phy.c | 80 ++++++++++++++++++++++++++++
>> drivers/net/wireless/ath/ath9k/debug.c | 5 --
>> drivers/net/wireless/ath/ath9k/eeprom_4k.c | 14 +++++
>> drivers/net/wireless/ath/ath9k/eeprom_9287.c | 15 ++++++
>> drivers/net/wireless/ath/ath9k/eeprom_def.c | 14 +++++
>> drivers/net/wireless/ath/ath9k/hw.c | 3 +-
>> drivers/net/wireless/ath/ath9k/hw.h | 2 +
>> drivers/net/wireless/ath/ath9k/xmit.c | 66 +++++++++++++++++++----
>> 8 files changed, 181 insertions(+), 18 deletions(-)
>>
>
>
> --
> Regards,
> Oleksij
>



--
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep

2014-12-27 14:12:32

by Lorenzo Bianconi

[permalink] [raw]
Subject: [RFC 3/3] ath9k: enable per-packet TPC on AR9002 based chips

Enable per-packet TPC on AR9002 based chips by default

Signed-off-by: Lorenzo Bianconi <[email protected]>
---
drivers/net/wireless/ath/ath9k/debug.c | 5 -----
drivers/net/wireless/ath/ath9k/hw.c | 3 +--
2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index c43e2ad..a52cbf13 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1150,11 +1150,6 @@ static ssize_t write_file_tpc(struct file *file, const char __user *user_buf,
ssize_t len;
bool tpc_enabled;

- if (!AR_SREV_9300_20_OR_LATER(ah)) {
- /* ar9002 does not support TPC for the moment */
- return -EOPNOTSUPP;
- }
-
len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 258c4d2..e2e4441 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -422,8 +422,7 @@ static void ath9k_hw_init_defaults(struct ath_hw *ah)
ah->power_mode = ATH9K_PM_UNDEFINED;
ah->htc_reset_init = true;

- /* ar9002 does not support TPC for the moment */
- ah->tpc_enabled = !!AR_SREV_9300_20_OR_LATER(ah);
+ ah->tpc_enabled = true;

ah->ani_function = ATH9K_ANI_ALL;
if (!AR_SREV_9300_20_OR_LATER(ah))
--
2.1.0


2014-12-30 10:18:34

by Oleksij Rempel

[permalink] [raw]
Subject: Re: [RFC 0/3] add TPC capability for AR9002 based chips

Am 29.12.2014 um 15:18 schrieb Lorenzo Bianconi:
>> Am 28.12.2014 um 15:32 schrieb Lorenzo Bianconi:
>>>> Hi, can you please describe some testcases for you patches.
>>>>
>>>
>>> This patchset adds Transmission Power Control (TPC) for AR9002 based
>>> chips. IOW it enables the capability of correct TX power on per-packet
>>> basis. It is preparatory for upcoming Thomas's joint rate and power
>>> control
>>> algorithm.
>>
>> Do you mean, right now there is no way to test your patches?
>>
>
> I have just added TPC support to ath9k. In order to exploit that hw
> feature we have to wait Thomas's algorithm :).
> However in order to test patches you can set tx_power field of
> ath_frame_info data structure in setup_frame_info() to a different
> value (for the moment it is set to MAX_RATE_POWER) and measure the RX
> power on the other end of the link (this is what I did).

Ok, thank you.
We will talk with Adrian how to mesure it at home.

>
> Regards,
> Lorenzo
>
>>
>>> Regards,
>>> Lorenzo
>>>
>>>> Am 27.12.2014 um 15:12 schrieb Lorenzo Bianconi:
>>>>> This patchset adds TPC capability to ath9k for AR9002 based chips
>>>>>
>>>>> *[RFC 1/3]: add TX power per-rate tables to cap TX power in TX descriptor path
>>>>> *[RFC 2/3]: cap per-packet TX power according to TX power per-rate tables
>>>>> *[RFC 3/3]: enable per-packet TPC on AR9002 based chips by default
>>>>>
>>>>> This pachset is based on Adrian Chadd's hints
>>>>> (https://www.mail-archive.com/[email protected]/msg10396.html)
>>>>>
>>>>> Lorenzo Bianconi (3):
>>>>> ath9k: add power per-rate tables for AR9002 chips
>>>>> ath9k: add TPC to TX path for AR9002 based chips
>>>>> ath9k: enable per-packet TPC on AR9002 based chips
>>>>>
>>>>> drivers/net/wireless/ath/ath9k/ar5008_phy.c | 80 ++++++++++++++++++++++++++++
>>>>> drivers/net/wireless/ath/ath9k/debug.c | 5 --
>>>>> drivers/net/wireless/ath/ath9k/eeprom_4k.c | 14 +++++
>>>>> drivers/net/wireless/ath/ath9k/eeprom_9287.c | 15 ++++++
>>>>> drivers/net/wireless/ath/ath9k/eeprom_def.c | 14 +++++
>>>>> drivers/net/wireless/ath/ath9k/hw.c | 3 +-
>>>>> drivers/net/wireless/ath/ath9k/hw.h | 2 +
>>>>> drivers/net/wireless/ath/ath9k/xmit.c | 66 +++++++++++++++++++----
>>>>> 8 files changed, 181 insertions(+), 18 deletions(-)
>>>>>
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Oleksij
>>>>
>>>
>>>
>>>
>>
>>
>> --
>> Regards,
>> Oleksij
>>
>
>
>


--
Regards,
Oleksij


Attachments:
signature.asc (213.00 B)
OpenPGP digital signature

2014-12-29 13:35:26

by Oleksij Rempel

[permalink] [raw]
Subject: Re: [RFC 0/3] add TPC capability for AR9002 based chips

Am 28.12.2014 um 15:32 schrieb Lorenzo Bianconi:
>> Hi, can you please describe some testcases for you patches.
>>
>
> This patchset adds Transmission Power Control (TPC) for AR9002 based
> chips. IOW it enables the capability of correct TX power on per-packet
> basis. It is preparatory for upcoming Thomas's joint rate and power
> control
> algorithm.

Do you mean, right now there is no way to test your patches?


> Regards,
> Lorenzo
>
>> Am 27.12.2014 um 15:12 schrieb Lorenzo Bianconi:
>>> This patchset adds TPC capability to ath9k for AR9002 based chips
>>>
>>> *[RFC 1/3]: add TX power per-rate tables to cap TX power in TX descriptor path
>>> *[RFC 2/3]: cap per-packet TX power according to TX power per-rate tables
>>> *[RFC 3/3]: enable per-packet TPC on AR9002 based chips by default
>>>
>>> This pachset is based on Adrian Chadd's hints
>>> (https://www.mail-archive.com/[email protected]/msg10396.html)
>>>
>>> Lorenzo Bianconi (3):
>>> ath9k: add power per-rate tables for AR9002 chips
>>> ath9k: add TPC to TX path for AR9002 based chips
>>> ath9k: enable per-packet TPC on AR9002 based chips
>>>
>>> drivers/net/wireless/ath/ath9k/ar5008_phy.c | 80 ++++++++++++++++++++++++++++
>>> drivers/net/wireless/ath/ath9k/debug.c | 5 --
>>> drivers/net/wireless/ath/ath9k/eeprom_4k.c | 14 +++++
>>> drivers/net/wireless/ath/ath9k/eeprom_9287.c | 15 ++++++
>>> drivers/net/wireless/ath/ath9k/eeprom_def.c | 14 +++++
>>> drivers/net/wireless/ath/ath9k/hw.c | 3 +-
>>> drivers/net/wireless/ath/ath9k/hw.h | 2 +
>>> drivers/net/wireless/ath/ath9k/xmit.c | 66 +++++++++++++++++++----
>>> 8 files changed, 181 insertions(+), 18 deletions(-)
>>>
>>
>>
>> --
>> Regards,
>> Oleksij
>>
>
>
>


--
Regards,
Oleksij


Attachments:
signature.asc (213.00 B)
OpenPGP digital signature

2014-12-29 14:18:22

by Lorenzo Bianconi

[permalink] [raw]
Subject: Re: [RFC 0/3] add TPC capability for AR9002 based chips

> Am 28.12.2014 um 15:32 schrieb Lorenzo Bianconi:
>>> Hi, can you please describe some testcases for you patches.
>>>
>>
>> This patchset adds Transmission Power Control (TPC) for AR9002 based
>> chips. IOW it enables the capability of correct TX power on per-packet
>> basis. It is preparatory for upcoming Thomas's joint rate and power
>> control
>> algorithm.
>
> Do you mean, right now there is no way to test your patches?
>

I have just added TPC support to ath9k. In order to exploit that hw
feature we have to wait Thomas's algorithm :).
However in order to test patches you can set tx_power field of
ath_frame_info data structure in setup_frame_info() to a different
value (for the moment it is set to MAX_RATE_POWER) and measure the RX
power on the other end of the link (this is what I did).

Regards,
Lorenzo

>
>> Regards,
>> Lorenzo
>>
>>> Am 27.12.2014 um 15:12 schrieb Lorenzo Bianconi:
>>>> This patchset adds TPC capability to ath9k for AR9002 based chips
>>>>
>>>> *[RFC 1/3]: add TX power per-rate tables to cap TX power in TX descriptor path
>>>> *[RFC 2/3]: cap per-packet TX power according to TX power per-rate tables
>>>> *[RFC 3/3]: enable per-packet TPC on AR9002 based chips by default
>>>>
>>>> This pachset is based on Adrian Chadd's hints
>>>> (https://www.mail-archive.com/[email protected]/msg10396.html)
>>>>
>>>> Lorenzo Bianconi (3):
>>>> ath9k: add power per-rate tables for AR9002 chips
>>>> ath9k: add TPC to TX path for AR9002 based chips
>>>> ath9k: enable per-packet TPC on AR9002 based chips
>>>>
>>>> drivers/net/wireless/ath/ath9k/ar5008_phy.c | 80 ++++++++++++++++++++++++++++
>>>> drivers/net/wireless/ath/ath9k/debug.c | 5 --
>>>> drivers/net/wireless/ath/ath9k/eeprom_4k.c | 14 +++++
>>>> drivers/net/wireless/ath/ath9k/eeprom_9287.c | 15 ++++++
>>>> drivers/net/wireless/ath/ath9k/eeprom_def.c | 14 +++++
>>>> drivers/net/wireless/ath/ath9k/hw.c | 3 +-
>>>> drivers/net/wireless/ath/ath9k/hw.h | 2 +
>>>> drivers/net/wireless/ath/ath9k/xmit.c | 66 +++++++++++++++++++----
>>>> 8 files changed, 181 insertions(+), 18 deletions(-)
>>>>
>>>
>>>
>>> --
>>> Regards,
>>> Oleksij
>>>
>>
>>
>>
>
>
> --
> Regards,
> Oleksij
>



--
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep