Please note: This project is no longer active. The website is kept online for historic purposes only.
If you´re looking for a Linux driver for your Atheros WLAN device, you should continue here .

Ticket #1324 (new enhancement)

Opened 15 years ago

Last modified 14 years ago

TX Power Setting Hash-up

Reported by: mentor Assigned to: mentor
Priority: minor Milestone:
Component: madwifi: 802.11 stack Version: trunk
Keywords: Cc:
Patch is attached: 1 Pending:

Description

TBA

Attachments

madwifi-txpower.diff (11.2 kB) - added by mentor on 05/19/07 19:31:05.
Attempt One
madwifi-txpower.2.diff (12.6 kB) - added by mentor on 06/03/07 03:28:16.
Attempt Two - Not tested at all, but probably won't suffer from the first crash
madwifi-txpower.3.diff (15.7 kB) - added by mentor on 06/04/07 10:54:09.
Attempt Three

Change History

05/19/07 19:31:05 changed by mentor

  • attachment madwifi-txpower.diff added.

Attempt One

05/21/07 07:08:42 changed by mrenzmann

  • patch_attached set to 1.

05/25/07 12:46:18 changed by rozteck@interia.pl

I give it a try and got

[42949395.340000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[42949395.350000] pgd = c3994000
[42949395.350000] [00000000] *pgd=03927031, *pte=00000000, *ppte=00000000
[42949395.360000] Internal error: Oops: 0 [#1]
[42949395.360000] Modules linked in: ath_pci ath_dfs ath_rate_atheros wlan ath_hal hdlc syncppp lapb cryptodev ocf ixp400_eth ixp400
[42949395.360000] CPU: 0
[42949395.360000] PC is at 0x0
[42949395.360000] LR is at ieee80211_ifattach+0x2a0/0x350 [wlan]
[42949395.360000] pc : [<00000000>]    lr : [<bf4f3c6c>]    Tainted: P
[42949395.360000] sp : c351dcbc  ip : c351dcac  fp : c351dd08
[42949395.360000] r10: 000011c8  r9 : c3f34000  r8 : c3f98000
[42949395.360000] r7 : c3f34000  r6 : c3f342e0  r5 : 00000000  r4 : 0000012e
[42949395.360000] r3 : c3f34314  r2 : c3f34304  r1 : 00000064  r0 : c3f342e0
[42949395.360000] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  Segment user
[42949395.360000] Control: 39FF  Table: 03994000  DAC: 00000015
[42949395.360000] Process insmod (pid: 176, stack limit = 0xc351c250)
[42949395.360000] Stack: (0xc351dcbc to 0xc351e000)
[42949395.360000] dca0:                                                                c3f98000
[42949395.360000] dcc0: 000080e4 c3f342e0 00000004 c3f98000 000011c8 c351dd00 c351dce4 bf1aa178
[42949395.360000] dce0: bf1ca70c 0000015a c3f9aa30 c3f356b8 00000001 c3f342e0 00000004 c351ddc0
[42949395.360000] dd00: c351dd0c bf54305c bf4f39d8 00000000 00000001 c3f34c70 00000000 00000fff
[42949395.360000] dd20: 00000001 00000001 00000043 00000000 c3f342e4 c3f35748 c3f13000 c3f98000
[42949395.360000] dd40: c3f342e0 c3f35b30 00000001 00000000 60000013 0000001a 00000000 00000000
[42949395.360000] dd60: 00000000 00000002 00000000 00000001 00000000 00000000 00000000 00000000
[42949395.360000] dd80: 00000000 00000000 00000000 00000000 c0057650 c0057308 c3f34000 c330a400
[42949395.360000] dda0: c3f342e0 0000001b 48000000 bf54aefc 00000000 c351ddfc c351ddc4 bf543894
[42949395.360000] ddc0: bf541bc8 c3f34000 c4820000 00000000 c351dd08 c330a400 bf54af8c ffffffed
[42949395.360000] dde0: 00000000 00000000 c3f752d8 00000000 c351de1c c351de00 c00e353c bf543628
[42949395.360000] de00: c330a448 c00e34dc 00000000 bf54afb8 c351de3c c351de20 c00fa69c c00e34e8
[42949395.360000] de20: c330a448 bf54afb8 c330a590 bf54afb8 c351de58 c351de40 c00fa7d0 c00fa648
[42949395.360000] de40: 00000000 c351de5c c00fa78c c351de84 c351de5c c00f9c70 c00fa798 c01c0df4
[42949395.360000] de60: c01c0e0c c330a4d8 bf54afe4 bf54afb8 00000000 c01c0c58 c351de94 c351de88
[42949395.360000] de80: c00fa810 c00f9c2c c351debc c351de98 c00fa15c c00fa7fc bf54afb8 bf54b0d8
[42949395.360000] dea0: 00000000 c4818530 00000000 c3f752b0 c351ded0 c351dec0 c00fac28 c00fa0fc
[42949395.360000] dec0: bf54af8c c351dee8 c351ded4 c00e3320 c00faba4 bf54d024 c3f752d0 c351def8
[42949395.360000] dee0: c351deec bf54d030 c00e32d8 c351dfa4 c351defc c0055008 bf54d00c 00000000
[42949395.360000] df00: 00000348 000002b0 0000002c 00000000 000002ad c351c000 00000000 00000000
[42949395.360000] df20: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000009
[42949395.360000] df40: 00000000 0000000f 00000000 00000000 0000000a 00000015 00000014 c481b370
[42949395.360000] df60: c3318620 c4818485 c4805000 00000004 c3374860 00000000 00000000 0001d648
[42949395.360000] df80: 0006b2ac 0006f01d 00000080 c001f024 c351c000 beb9dbac 00000000 c351dfa8
[42949395.360000] dfa0: c001ee80 c0053cb8 0006b2ac 0006f01d 00900080 0006f1d0 0001d648 0006f1b8
[42949395.360000] dfc0: 0001d648 0006b2ac 0006f01d 0006f1b8 0006f190 00000000 beb9dbac beb9ba78
[42949395.360000] dfe0: beb9ba7c beb9ba4c 00031128 4009e63c 20000010 00900080 00000000 00000000
[42949395.360000] Backtrace:
[42949395.360000] [<bf4f39cc>] (ieee80211_ifattach+0x0/0x350 [wlan]) from [<bf54305c>] (ath_attach+0x14a0/0x17fc [ath_pci])
[42949395.360000]  r7 = 00000004  r6 = C3F342E0  r5 = 00000001  r4 = C3F356B8
[42949395.360000] [<bf541bbc>] (ath_attach+0x0/0x17fc [ath_pci]) from [<bf543894>] (ath_pci_probe+0x278/0x380 [ath_pci])
[42949395.360000] [<bf54361c>] (ath_pci_probe+0x0/0x380 [ath_pci]) from [<c00e353c>] (pci_device_probe+0x60/0x80)
[42949395.360000] [<c00e34dc>] (pci_device_probe+0x0/0x80) from [<c00fa69c>] (driver_probe_device+0x60/0xd4)
[42949395.360000]  r7 = BF54AFB8  r6 = 00000000  r5 = C00E34DC  r4 = C330A448
[42949395.360000] [<c00fa63c>] (driver_probe_device+0x0/0xd4) from [<c00fa7d0>] (__driver_attach+0x44/0x64)
[42949395.360000]  r7 = BF54AFB8  r6 = C330A590  r5 = BF54AFB8  r4 = C330A448
[42949395.360000] [<c00fa78c>] (__driver_attach+0x0/0x64) from [<c00f9c70>] (bus_for_each_dev+0x50/0x84)
[42949395.360000]  r6 = C00FA78C  r5 = C351DE5C  r4 = 00000000
[42949395.360000] [<c00f9c20>] (bus_for_each_dev+0x0/0x84) from [<c00fa810>] (driver_attach+0x20/0x28)
[42949395.360000]  r7 = C01C0C58  r6 = 00000000  r5 = BF54AFB8  r4 = BF54AFE4
[42949395.360000] [<c00fa7f0>] (driver_attach+0x0/0x28) from [<c00fa15c>] (bus_add_driver+0x6c/0x134)
[42949395.360000] [<c00fa0f0>] (bus_add_driver+0x0/0x134) from [<c00fac28>] (driver_register+0x90/0xa0)
[42949395.360000] [<c00fab98>] (driver_register+0x0/0xa0) from [<c00e3320>] (__pci_register_driver+0x54/0x94)
[42949395.360000]  r4 = BF54AF8C
[42949395.360000] [<c00e32cc>] (__pci_register_driver+0x0/0x94) from [<bf54d030>] (init_ath_pci+0x30/0x6c [ath_pci])
[42949395.360000]  r4 = C3F752D0
[42949395.360000] [<bf54d000>] (init_ath_pci+0x0/0x6c [ath_pci]) from [<c0055008>] (sys_init_module+0x135c/0x14c0)
[42949395.360000] [<c0053cac>] (sys_init_module+0x0/0x14c0) from [<c001ee80>] (ret_fast_syscall+0x0/0x2c)
[42949395.360000] Code: bad PC value.
[42949395.360000]  <0>Kernel panic - not syncing: Fatal exception
[42949395.850000] [<c0022bac>] (dump_stack+0x0/0x14) from [<c0035b40>] (panic+0x54/0x12c)
[42949395.860000] [<c0035aec>] (panic+0x0/0x12c) from [<c0022e74>] (die+0x26c/0x2b8)
[42949395.870000]  r3 = 00000001  r2 = C351C000  r1 = C0201C98  r0 = C018C110
[42949395.870000] [<c0022c08>] (die+0x0/0x2b8) from [<c0024fac>] (__do_kernel_fault+0x6c/0x80)
[42949395.880000] [<c0024f40>] (__do_kernel_fault+0x0/0x80) from [<c00252cc>] (do_page_fault+0x1fc/0x214)
[42949395.890000]  r7 = C30B8040  r6 = C3524908  r5 = C3312C20  r4 = FFFFFFEC
[42949395.900000] [<c00250d0>] (do_page_fault+0x0/0x214) from [<c002531c>] (do_translation_fault+0x38/0xd8)
[42949395.910000] [<c00252e4>] (do_translation_fault+0x0/0xd8) from [<c00254c8>] (do_PrefetchAbort+0x18/0x1c)
[42949395.920000] [<c00254b0>] (do_PrefetchAbort+0x0/0x1c) from [<c001eba0>] (__pabt_svc+0x40/0x80)
[42949395.930000] [<bf4f39cc>] (ieee80211_ifattach+0x0/0x350 [wlan]) from [<bf54305c>] (ath_attach+0x14a0/0x17fc [ath_pci])
[42949395.940000]  r7 = 00000004  r6 = C3F342E0  r5 = 00000001  r4 = C3F356B8
[42949395.940000] [<bf541bbc>] (ath_attach+0x0/0x17fc [ath_pci]) from [<bf543894>] (ath_pci_probe+0x278/0x380 [ath_pci])
[42949395.950000] [<bf54361c>] (ath_pci_probe+0x0/0x380 [ath_pci]) from [<c00e353c>] (pci_device_probe+0x60/0x80)
[42949395.960000] [<c00e34dc>] (pci_device_probe+0x0/0x80) from [<c00fa69c>] (driver_probe_device+0x60/0xd4)
[42949395.970000]  r7 = BF54AFB8  r6 = 00000000  r5 = C00E34DC  r4 = C330A448
[42949395.980000] [<c00fa63c>] (driver_probe_device+0x0/0xd4) from [<c00fa7d0>] (__driver_attach+0x44/0x64)
[42949395.990000]  r7 = BF54AFB8  r6 = C330A590  r5 = BF54AFB8  r4 = C330A448
[42949396.000000] [<c00fa78c>] (__driver_attach+0x0/0x64) from [<c00f9c70>] (bus_for_each_dev+0x50/0x84)
[42949396.010000]  r6 = C00FA78C  r5 = C351DE5C  r4 = 00000000
[42949396.010000] [<c00f9c20>] (bus_for_each_dev+0x0/0x84) from [<c00fa810>] (driver_attach+0x20/0x28)
[42949396.020000]  r7 = C01C0C58  r6 = 00000000  r5 = BF54AFB8  r4 = BF54AFE4
[42949396.030000] [<c00fa7f0>] (driver_attach+0x0/0x28) from [<c00fa15c>] (bus_add_driver+0x6c/0x134)
[42949396.040000] [<c00fa0f0>] (bus_add_driver+0x0/0x134) from [<c00fac28>] (driver_register+0x90/0xa0)
[42949396.050000] [<c00fab98>] (driver_register+0x0/0xa0) from [<c00e3320>] (__pci_register_driver+0x54/0x94)
[42949396.060000]  r4 = BF54AF8C
[42949396.060000] [<c00e32cc>] (__pci_register_driver+0x0/0x94) from [<bf54d030>] (init_ath_pci+0x30/0x6c [ath_pci])
[42949396.070000]  r4 = C3F752D0
[42949396.070000] [<bf54d000>] (init_ath_pci+0x0/0x6c [ath_pci]) from [<c0055008>] (sys_init_module+0x135c/0x14c0)
[42949396.080000] [<c0053cac>] (sys_init_module+0x0/0x14c0) from [<c001ee80>] (ret_fast_syscall+0x0/0x2c)
[42949396.090000]

According to the gdb:

(gdb) list *(ieee80211_ifattach+0x2a0)
0x1898 is in ieee80211_ifattach (/mnt/sdb2/tomek/modules-clean/5000_madwifi/madwifi-atheros-r1860/net80211/ieee80211.c:335).
330             IEEE80211_VAPS_LOCK_INIT(ic, "ieee80211com_vaps");
331             TAILQ_INIT(&ic->ic_vaps);
332
333             ic->ic_set_txpow(ic, IEEE80211_TXPOWER_MAX);
334
335             ieee80211_crypto_attach(ic);
336             ieee80211_node_attach(ic);
337             ieee80211_power_attach(ic);
338             ieee80211_proto_attach(ic);
339             ieee80211_scan_attach(ic);

I have IXP425 platform running kernel 2.6.18-rt7 with CONFIG_PREEMPT_RT.

06/03/07 03:28:16 changed by mentor

  • attachment madwifi-txpower.2.diff added.

Attempt Two - Not tested at all, but probably won't suffer from the first crash

06/04/07 10:49:15 changed by rozteck@interia.pl

Good news - doesn't crashed and seemes working. However the iwlist reports the txpower values up to 34dBm for my ubiquiti sr5 card.

06/04/07 10:54:09 changed by mentor

  • attachment madwifi-txpower.3.diff added.

Attempt Three

06/04/07 10:56:43 changed by mentor

OK, this one works, but I need to finesse the initial power setting.

06/04/07 10:57:05 changed by mentor

Actually, I need to finesse power setting on channel change.

06/04/07 22:09:34 changed by rozteck@interia.pl

btw. the 2nd version crashed horribly on station side. on ap was good ;) 3rd version didn't tested yet.

06/04/07 23:13:16 changed by mentor

Well, I've been using Attempt 3 on station.

06/15/07 18:56:58 changed by rozteck@interia.pl

I've got one think no related to any of this patches, but somehow related with power setting in madwifi. I have enabled ATH_CAP_TPC when compiling madwifi. I have set tpc=0 when loading ath_pci. The result was that I was unable to change the power (not matter what I set, even 0, the card was transmitting with maximum power). So I have changed:

#ifdef ATH_CAP_TPC
	if (ic->ic_newtxpowlimit >= txpowlimit)
		ath_hal_settxpowlimit(ah, ic->ic_newtxpowlimit);
#else
	if (ic->ic_newtxpowlimit != txpowlimit)
		ath_hal_settxpowlimit(ah, ic->ic_newtxpowlimit);
#endif

to

#ifdef ATH_CAP_TPC_NOTYET
	if (ic->ic_newtxpowlimit >= txpowlimit)
		ath_hal_settxpowlimit(ah, ic->ic_newtxpowlimit);
#else
	if (ic->ic_newtxpowlimit != txpowlimit)
		ath_hal_settxpowlimit(ah, ic->ic_newtxpowlimit);
#endif

and was able to set the txpower correctly. Maybe should be done something like:

#ifdef ATH_CAP_TPC
	if ((sc->sc_hastpc) && (ic->ic_newtxpowlimit >= txpowlimit))
		ath_hal_settxpowlimit(ah, ic->ic_newtxpowlimit);
	else 
#endif
	if (ic->ic_newtxpowlimit != txpowlimit)
		ath_hal_settxpowlimit(ah, ic->ic_newtxpowlimit);

This would make the condition checking for tpc=0 as it would be when compiled without ATH_CAP_TPC set. The other question is if the TPC is working in madwifi? When I have enabled it on module load I'm getting very poor throughput (about 80B/s) on 4.9GHz band. Not tested on other cards. Btw. Sorry for offtopic.