Bug 14567

Summary: Ath5k: Txpower 0 dBm does not work correctly
Product: Drivers Reporter: Daniel Folkers (daniel.folkers)
Component: network-wirelessAssignee: drivers_network-wireless (drivers_network-wireless)
Status: RESOLVED CODE_FIX    
Severity: high CC: daniel.folkers, linville, me
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.31 Subsystem:
Regression: No Bisected commit-id:
Attachments: left 0dBm set, right 1dBm set
allow txpower = 0
txpower 0dBm works (2,10 and 20dBm also included)

Description Daniel Folkers 2009-11-09 11:39:23 UTC
Created attachment 23711 [details]
left 0dBm set, right 1dBm set

I did some testing with ath5k after the txpower of ath5k has become settable in the 2.6.31 kernel. I tested with a Rohde&Schwarz spectrum analyser, and did a channel power measurement. I used a R52H minipci card with Atheros AR5414 chipset in it, using the ath5k driver. The antenna output is connected with a coax cable to the spectrum analyser input (closed system). I used channel 11 (2462MHz) in Ad-Hoc mode. Txpower is set to 0dBm (1mW). 
A multicast with a duty cycle of 80% is used.

I did the following setting:

$ iwconfig wlan1 txpower 0
$ iwlist wlan1 txpower
wlan1    unknown transmit-power information
         Current Tx-Power=0 dBm     (1 mW)

As on the screenshot (left) is seen, the channel output is not 0dBm, but 13dBm.
The second screenshot (right) shows the same test but with txpower 1dBm, which works correcly
Comment 1 Bob Copeland 2009-11-13 12:57:16 UTC
Well, this code certainly looks suspect:


int
ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
                u8 ee_mode, u8 txpower)
{
[...]
        if (txpower == 0)
                txpower = AR5K_TUNE_DEFAULT_TXPOWER;


Guess what, it's 12.5 dBm... heh.

#define AR5K_TUNE_DEFAULT_TXPOWER		25
Comment 2 Bob Copeland 2009-11-14 15:23:22 UTC
Created attachment 23783 [details]
allow txpower = 0

Thank you for the excellent bug report, please let me know if this patch works.
Comment 3 Bob Copeland 2009-11-14 15:27:20 UTC
Also if it succeeds, let me know if I can add your 'Reported-by' and 'Tested-by' to the patch.
Comment 4 Daniel Folkers 2009-11-16 08:52:22 UTC
Created attachment 23797 [details]
txpower 0dBm works (2,10 and 20dBm also included)

You can add my "Reported-By" and "Tested-By" to the patch.
Do you expect this patch will be included in the next kernel-rc?
Comment 5 Bob Copeland 2009-11-16 13:36:03 UTC
It's up to John, but my guess is -rc7 is a little too late for 2.6.32, but I marked it for stable so as soon as it hits Linus' tree it will get picked up there -- so likely 2.6.32.1 or .2.