All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@openwrt.org>
To: Nick Kossifidis <mickflemm@gmail.com>
Cc: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>,
	jirislaby@gmail.com, johannes.berg@intel.com,
	ath5k-devel@lists.ath5k.org, linux-wireless@vger.kernel.org,
	linville@tuxdriver.com
Subject: Re: [ath5k-devel] [PATCH 2/2] ath5k: fix phy_init() to respect user txpower changes
Date: Thu, 26 Jul 2012 12:28:03 +0200	[thread overview]
Message-ID: <50111BB3.9090802@openwrt.org> (raw)
In-Reply-To: <CAFtRNNxEHaON-uBjgLyeJdgN6UKfed6fAeCYPpo6xToi3dixOw@mail.gmail.com>

On 2012-07-26 12:20 PM, Nick Kossifidis wrote:
> 2012/7/26 Thomas Huehn <thomas@net.t-labs.tu-berlin.de>:
>> Hi Nick,
>>
>> Nick Kossifidis schrieb:
>>
>>> 2012/7/26 Thomas Huehn <thomas@net.t-labs.tu-berlin.de>:
>>
>>> There is nothing in your patch that suggests that's related to this.
>>> Anyway there's a simple way to fix this:
>>>
>>> Just move this:
>>>
>>> 3575         /* Min/max in 0.25dB units */
>>> 3576         ah->ah_txpower.txp_min_pwr = 2 * rates[7];
>>> 3577         ah->ah_txpower.txp_cur_pwr = 2 * rates[0];
>>> 3578         ah->ah_txpower.txp_ofdm = rates[7];
>>>
>>> above the for loop and you are done.
>>>
>>> Note rates[i] don't hold tx power values, they hold indices to the
>>> channel powertable.
>>>
>>
>>
>> Are you agreeing that current ath5k txpower handling set from user space
>> is not working and we need to fix it ?
> 
> Is that a rhetorical question ? Just check out the TODOs on wireless.kernel.org.
> 
> The current code does not preserve the tx power value across resets,
> thats the problem and the change I mentioned above fixes it (patch on
> the way, it's just that where I am right now I don't have bw to
> download wireless-testing) but other than that when we set tx power
> without reseting at least it does what it's supposed to do (and the
> result is the same with madwifi, using a spectrum analyzer or another
> client/monitor interface you see some power levels supported or only
> the max txpower supported, it's really up to the vendor, not all of
> them follow Atheros's reference designs). Your patch passes 1dbm units
> on a function that expects 0.5dbm units, you fix the problem with
> preserving tx power but you break the tx power setting.
> 
> The change I mentioned above fixes the problem without introducing new
> variables just because "Felix will use the other one", I don't
> understand why you have a problem with that and why you think I don't
> want this to get fixed...
> 
>> Beside that, what about a channel switch and wrongly re-use txp_cur_pwr
>> on a channel witch other max power levels ?
> 
> That won't be a problem, when channel changes we 'll call
> 
> reset -> phy_init -> set_txpower -> (calibration) -> set rate target power
> 
> and then it's going to get limited before it's written on hw here:
> 
> max_pwr = min(max_pwr, (u16) ah->ah_txpower.txp_max_pwr) / 2;
> 
> txp_max_pwr is initialized on calibration (the max power for this
> channel), then it gets limited by CTL edge information on EEPROM, then
> by max_pwr and then max_pwr is limited by rate_info->target_power_X
> from EEPROM to create rates[i]. We write rates[i] on hw, not
> txp_cur_pwr.
I think it's a bad idea to store the user's choice of txpower in a
variable that internally gets reused to store the hw limit. Even when
the offset isn't added to it, it's still fragile.

A problem with this is that different channels have different max power
values, so if you switch to a channel with a lower power, and then
switch back (without explicitly changing txpower inbetween), don't you
then end up with less power than you configured?

This can be easily avoided by storing the user's txpower choice
separately from the actual hw limit...

- Felix

  reply	other threads:[~2012-07-26 10:28 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-23 16:01 [PATCH 0/2] ath5k: fixing broken power gain calibration at 5GHz and txpower handling Thomas Huehn
2012-07-23 16:01 ` [PATCH 1/2] ath5k: fix wrong per rate target power eeprom reads for AR5K_EEPROM_MODE_11A Thomas Huehn
2012-07-25 18:42   ` Nick Kossifidis
2012-07-25 18:55     ` Felix Fietkau
2012-07-25 22:22       ` Nick Kossifidis
2012-07-25 22:01     ` [ath5k-devel] " Thomas Huehn
2012-07-25 22:31       ` Nick Kossifidis
2012-08-04  8:14   ` Thomas Huehn
2012-08-04 15:28     ` Nick Kossifidis
2012-08-05 11:06       ` Thomas Huehn
2012-08-05 11:56         ` Nick Kossifidis
2012-08-05 12:37           ` Thomas Huehn
2012-08-05 12:59             ` Nick Kossifidis
2012-08-05 18:26             ` Nick Kossifidis
2012-07-23 16:01 ` [PATCH 2/2] ath5k: fix phy_init() to respect user txpower changes Thomas Huehn
2012-07-23 16:42   ` [ath5k-devel] " Bob Copeland
2012-07-23 18:25     ` Thomas Huehn
2012-07-23 18:29       ` Thomas Huehn
2012-07-23 19:20       ` Bob Copeland
2012-07-25 19:22   ` Nick Kossifidis
2012-07-25 23:07     ` Thomas Huehn
2012-07-25 23:23       ` Nick Kossifidis
2012-07-25 23:40         ` [ath5k-devel] " Thomas Huehn
2012-07-26 10:20           ` Nick Kossifidis
2012-07-26 10:28             ` Felix Fietkau [this message]
2012-07-26 10:31               ` Nick Kossifidis
2012-07-26 10:41                 ` Felix Fietkau
2012-07-26 17:48                   ` Nick Kossifidis
2012-07-26 20:56                     ` Thomas Huehn
2012-07-28 11:45                       ` Nick Kossifidis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50111BB3.9090802@openwrt.org \
    --to=nbd@openwrt.org \
    --cc=ath5k-devel@lists.ath5k.org \
    --cc=jirislaby@gmail.com \
    --cc=johannes.berg@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mickflemm@gmail.com \
    --cc=thomas@net.t-labs.tu-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.