2011-11-28 16:17:54

by Daniel Golle

[permalink] [raw]
Subject: [PATCH v1 0/3] support for antenna configuration profiles

Hi!

It took me a while to get this into a nice shape and make the code less hackish.
Thank you for all the helpful feedback on PATCH v0 and the RFC!
I'm looking forward to your comments and highly appreciate any further advise.

Changes since my previous patch:
* restructured nl80211 stuff, putting the whole thing into a NLA_NESTED makes
the parser happy.
* store selection state in the driver instead of overwriting the value in the
AntCtrlCommon field.
* expose selected switch_com_value in eeprom_4k.
* moved stuff in ath9k to where it belongs (afaik)
* lots of cosmetics

I got my patched-up version of iw and works like a charm with the ALL0258N now:

root@OpenWrt:/# iw list
Wiphy phy0:
Band 1:
...
Device supports antenna configuration profiles.
(*) 0 horiz (horizontal TX, vertical RX)
( ) 1 vert (vertical TX, horizontal RX)
...

root@OpenWrt:/# grep 9964 /sys/kernel/debug/ieee80211/phy0/ath9k/regdump
0x009964 0x00000000
root@OpenWrt:/# iw phy phy0 interface add wlan0 type station
root@OpenWrt:/# ifconfig wlan0 up
root@OpenWrt:/# grep 9964 /sys/kernel/debug/ieee80211/phy0/ath9k/regdump
0x009964 0x09a00210
root@OpenWrt:/# ifconfig wlan0 down
root@OpenWrt:/# iw set extant 1
root@OpenWrt:/# iw list
Wiphy phy0
Band 1:
...
Device supports antenna configuration profiles.
( ) 0 horiz (horizontal TX, vertical RX)
(*) 1 vert (vertical TX, horizontal RX)
...

root@OpenWrt:/# ifconfig wlan0 up
root@OpenWrt:/# grep 9964 /sys/kernel/debug/ieee80211/phy0/ath9k/regdump
0x009964 0x0a900120

Here the patch for iw. I'm planing to partially reimplement that in libiwinfo
for OpenWrt's LuCI.


Attachments:
(No filename) (1.72 kB)
signature.asc (836.00 B)
Digital signature
Download all attachments

2011-11-28 16:52:29

by Berg, Johannes

[permalink] [raw]
Subject: Re: [PATCH v1 0/3] support for antenna configuration profiles

T24gTW9uLCAyMDExLTExLTI4IGF0IDE3OjEyICswMTAwLCBEYW5pZWwgR29sbGUgd3JvdGU6Cgo+
IEl0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IE11ZW5jaGVuCkdlc2NoYWVmdHNmdWVocmVyOiBEb3VnbGFzIEx1c2ssIFBldGVyIEdsZWlz
c25lciwgSGFubmVzIFNjaHdhZGVyZXIKUmVnaXN0ZXJnZXJpY2h0OiBNdWVuY2hlbiBIUkIgNDc0
NTYgClVzdC4tSWROci4vVkFUIFJlZ2lzdHJhdGlvbiBOby46IERFMTI5Mzg1ODk1CkNpdGliYW5r
IEZyYW5rZnVydCBhLk0uIChCTFogNTAyIDEwOSAwMCkgNjAwMTE5MDUyCg==


2011-11-30 08:57:28

by Berg, Johannes

[permalink] [raw]
Subject: Re: [PATCH v1 0/3] support for antenna configuration profiles

T24gVHVlLCAyMDExLTExLTI5IGF0IDEyOjUyICswMTAwLCBEYW5pZWwgR29sbGUgd3JvdGU6Cgo+
IE15IGlkZWEgaXMgdG8gaGF2ZSBhIGdlbmVyaWMgQVBJIGFsbG93aW5nIHRoZSB1c2VyIHRvIHNl
bGVjdCBjb25maWd1cmF0aW9uCj4gcHJvZmlsZXMgZm9yIGV4dGVybmFsIExOQS9taXhlcnMgZm91
bmQgaW4gb3V0ZG9vciBoaWdoLXBvd2VyIGFwcGxpYW5jZXMuCj4gSSBhbHNvIGZpcnN0IHRob3Vn
aHQgb2YganVzdCB1c2luZyB0aGUgZXhpc3RpbmcgYW50ZW5uYSBzZWxlY3Rpb24gQVBJIGZvciB0
aGF0LAo+IGJ1dCB0aGVyZSBhcmUgZ29vZCByZWFzb25zIGFnYWluc3QgdGhhdDoKPiAqIEFudGVu
bmEgY29udHJvbCBBUEkgYXNzdW1lcyB0aGF0IHRoZSBhbGxvd2VkIHZhbHVlcyBmb3IgdHhfYW50
IGFuZCByeF9hbnQgYXJlCj4gaW5kZXBlbmRlbnQgb2YgZWFjaCBvdGhlci4gSW4gaGlnaC1wb3dl
ciBhcHBsaWNhdGlvbnMsIHRoaXMgaXMgbm90IHRoZSBjYXNlCj4gKGkuZS4geW91J2xsIHByb2Jh
Ymx5IGV2ZW4gZGFtY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ZCB3ZQo+IHdhbnQgdG8gc2VsZWN0IHdoaWNoIG9uZShzKSB0
byB1c2UuCj4gCj4gSSBob3BlIHRoaW5ncyBhcmUgbW9yZSBjbGVhciBub3cuCgpOb3QgbXVjaCB0
byBiZSBob25lc3QsIEkgaGF2ZSBubyBpZGVhIGhvdyB0aGlzIHdvcmtzLiA6LSkKCkZvciBleGFt
cGxlLCB0aGlzIHNlZW1zIGxpa2UgaGFyZHdhcmUgbW9kcywgc28gaG93IGRvZXMgdGhlIGRyaXZl
ciBrbm93CndoYXQgdGhlIHByb2ZpbGVzIGFyZT8KCmpvaGFubmVzCgotLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLQpJbnRlbCBHbWJICkRvcm5hY2hlciBTdHJhc3NlIDEKODU2MjIgRmVsZGtp
cmNoZW4vTXVlbmNoZW4sIERldXRzY2hsYW5kIApTaXR6IGRlciBHZXNlbGxzY2hhZnQ6IEZlbGRr
aXJjaGVuIGJlaSBNdWVuY2hlbgpHZXNjaGFlZnRzZnVlaHJlcjogRG91Z2xhcyBMdXNrLCBQZXRl
ciBHbGVpc3NuZXIsIEhhbm5lcyBTY2h3YWRlcmVyClJlZ2lzdGVyZ2VyaWNodDogTXVlbmNoZW4g
SFJCIDQ3NDU2IApVc3QuLUlkTnIuL1ZBVCBSZWdpc3RyYXRpb24gTm8uOiBERTEyOTM4NTg5NQpD
aXRpYmFuayBGcmFua2Z1cnQgYS5NLiAoQkxaIDUwMiAxMDkgMDApIDYwMDExOTA1Mgo=


2011-11-29 11:52:45

by Daniel Golle

[permalink] [raw]
Subject: Re: [PATCH v1 0/3] support for antenna configuration profiles

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Johannes,

On 11/28/2011 05:52 PM, Johannes Berg wrote:
> Can you remind us what it is you're trying to achieve? And why it can't
> be done with the antenna selection API today?
My idea is to have a generic API allowing the user to select configuration
profiles for external LNA/mixers found in outdoor high-power appliances.
I also first thought of just using the existing antenna selection API for that,
but there are good reasons against that:
* Antenna control API assumes that the allowed values for tx_ant and rx_ant are
independent of each other. In high-power applications, this is not the case
(i.e. you'll probably even damage the RX-part of your hardware when selecting
the same path for RX and TX). Therefore simple bitmasks such as
available_antennas_rx/tx won't do the job.
* Both, external mixer and antenna control may be used together in MiMo
applications, e.g. you may have antennas 0,1 which are controlled by the usual
antenna selection API and additionally you got an external LNA/mixer which
allows you to select either the built-in antenna-pair or an externally connected
one.
In my example, it looks like this

+---------+ +-------+
| ---TXa--- |
| WiFi ---RXa1-- ext. |
| Chip ---RXa2-- LNA |
|(AR9285) ......... mixer |
+---------+ +-------+

You may still want to use antenna selection API to selected either RX-path 0 or
1 or both of the AR9285, additionally you want to select a profile for the
external LNA/mixer.

* As Adrian pointed out and I agree with, it's nice to give the user some
information about the available configuration profiles, i.e. have user-parsable
names and descriptions of the different configuration profiles (e.g.
"built-in"/"external", "horizontal"/"vertical", ...) for the device.

My current solution how things are done in ath9k is specific for the AR9285, but
once there is a generic infrastructure for this in mac80211, it can be used for
different solutions, e.g. ath5k-devices with a similar setup which control the
ext.LNA/mixer using some GPIO PINs.
In future we may also see devices with several directional MiMo beams and we
want to select which one(s) to use.

I hope things are more clear now.


Cheers


Daniel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJO1MeFAAoJEDy9cKN/1Et0R14P/0boU8k9U1CHDJAQzLswT6aF
ts9gE0DLvC10qSu15sdRWH516T9K3sFeq2LlSYx4ljV6G3Y1lECzlJjuhFk15ZW+
5Q0dlofmEhmO3shdvODgrKcqIdmvDkxHRqlCXtYuEPsDKi3QWVEqj8nji588nORt
wCDGxdNEl8HJYmKi8R+OsAZcypCylV5HFo/J+Xt9pgQmP6gtqGkF3s+KwiPLDFo8
BnusiD2aQOgqbSs/63t+yaapGLi2ATwFjgKOE/5DywyKUHPGT6e/SouGnWHVuEfA
+Kq33fUm5C93VK9aBVg+hawj6LGB9DAizGlDaEUib4TVt6R23N5HaeOp4uI+T41K
pjz3jQD6CsTM8Ypo3UvsRI+SWvacNPcmRqJMplOL7sc9pkNx1UatP/wE2/pRPfki
X1t9Lw8cb6FIeRZAe+ftiDZN5TEvqOTXBMAYe4tsPMr/GZ/g5eubdZDiHVe0gkQ2
oIWFq8vnTX8UUP8jz0h4xkENsPoMHi6YwEFULIqdPfwEFqBXsxOCFPednZ5BU6ww
KO9CQpMWqDhDtGsp5jsaC5s1K2Mo7w2hmfwMZjxy+wudftL7oe25niqlJZsTBKa9
j72u+XwqXkf4wmsbbaPmDOI93mqBcgSPOUtaEz3RRZbi4EFFQUZA1+bX0SMdUHxD
8oTrNnbFvv7ow1T2oQfy
=I+el
-----END PGP SIGNATURE-----

2011-11-29 13:52:12

by Daniel Golle

[permalink] [raw]
Subject: Re: [PATCH v1 0/3] support for antenna configuration profiles

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/28/2011 05:52 PM, Johannes Berg wrote:
> Can you remind us what it is you're trying to achieve? And why it can't
> be done with the antenna selection API today?

I can implement antenna configuration profiles in hwsim or try to get an
ALL0258N hardware sample for someone, given there is a need for that.

Cheers

Daniel

- --
ALLNET GmbH ; Maistr. 2 ; D-82110 Germering ; Germany
Tel. +49-89-89422222 - Fax +49-89-89422233
http://www.allnet.de
email: Daniel Golle <[email protected]>
Schulungs-/Veranstaltungsprogramm: http://www.802lab.de<http://www.802lab.de/>
Geschäftsführer: Wolfgang Marcus Bauer
Handelsregister München B 95922 ; UST-ID-Nr. DE 128214294 ;
St.-Nr.117/115/00164
WEEE-Reg.-NR. DE 13101093
Bankverbindung:
Sparkasse Fürstenfeldbruck KTO: 2774594 ; BLZ: 70053070
Swift-Code: BYLADEM1FFB ; IBAN: DE61700530700002774594
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJO1OOCAAoJEDy9cKN/1Et0bn4QAKjBz7EDTkXnrf9VGA25ClMT
92zTmqJA5WDd75YZGw106o9JxjVWMJ4asK0L2+sLKEUlqJnFu/FpQt1bov8zmxT1
cyEbKRwAetSsaDcgH/v27orhdTusdN1ZhZR/Wv+Gpi+wTsfXfIuDJR8OcJvjPvl8
Bpl5eIWXVs0eMRzdCVmmZksgW7yClZnt/Y4cuda6nNuh/8H5D8XYtR/7i6lQIjGg
vJzfBgsYSya1AhF2yF1LBi7/getp+CK9Meo6qHRa8/CtVLIzOfLxaQ8ObZh7WVfT
PO6Nrw5kL8HkVmwve0W2I4ieNQJJVANe2N5CWpf5Lk4vEjSf38/r+7EXXOtu0bdd
LhyKKQzAhFzp0hEmIgcClSud9n6hbmBOWdkLXeUIbXShm5vddEmXs3Rqzv4UorSQ
4teU7xE4buNOnA+yzE3BUHkdRiVZK3k+iXmnU1sXVMx2ovMAVHa3TKr5yTfdz/sc
ByXC3m1TL/EiY5jzmAbhMfmhKiO/mQcRsBBdHqDFVBMNUkkPO7nFeV3Q3kxhOAOi
qZY09LBoqSd/sITy9BHa4zgLun4dj68F5//cTdOG8KnoOItV9btkoe55e2CvPHmf
6gC6XnNwojsUOc/FlneK9VHWmRs7/kWKJAed9UgPR0IXCy6q7yieCBKJfXx1ku9i
RCzIbTm7jb0YysL+X5Ml
=YIlR
-----END PGP SIGNATURE-----

2011-12-03 14:08:08

by Daniel Golle

[permalink] [raw]
Subject: Re: [PATCH v1 0/3] support for antenna configuration profiles

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sorry for the delay, I replied off-list by accident and noticed that just now...

On 11/30/2011 09:57 AM, Johannes Berg wrote:
> For example, this seems like hardware mods, so how does the driver know
> what the profiles are?
Available profiles are passed to the driver via platform_data of the PCI device
which is set in the board-setup code.
See changes made to ath9k_platform in the ath9k-specific part 3 of the patchset
and the board-setup (in the appendix of my previous v0 patch-set, as there were
no changes to that since the previous patch, I didn't re-post the changes needed
in arch/mips/ar71xx/dev-ap91-pci.c and my board-setup).


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJO2i0vAAoJEDy9cKN/1Et0vxUP/0ubjhKrnOGV+zPPY2P4m6HK
2n0mhcF9rYA3+7I1DB+6ZwECUvWgJTW/+XSG792huFcND7S9KwREa7RlCj9ES6lQ
w1WDuk2xcazZHpGN1+TCkLQHDXDQQ/wBZfUppF4ELGhyj0Gujoo1VcADqcQMwVaO
xVaKUcQN+g5HHsvtnApWh68MfYzEEG5Hk1Z2wqvAc4f8e1knVEZxkMb2nE0o2pLH
mW6sgcg81lXfnK6P9RBPlEQ3Ef8qxpXvrcEbhBv5LXak1waCx6T7ZIV1CsDytWAm
C6Rkaitcu10gua7i4dnlWc6wyKQVBd+sIfrb+QPInmMxbSdzQj1nOylth/3Y6CAJ
b+vQdDDl1WJriVESS/N2ooA7UhHoQhp7/tBQESHZFxE56ejF++fuq4I/I8OqvCIV
qQsuyY36xbHoh/WztqMOBWTcG4y6Mjd9Eb36yV0DeHVKjUrtsBUMaRUyLXMOAjRm
P5XzdbUAKm7HfqKdqxHoNehH2GZ6D46BhGvfUierlZOjAyYPZyeRuJgA15em2zpI
xf98G80m8bN3K4EUKFK78FqULGaitxI4IyR18bdP/5W9bb1Y8IhEKY0pohHX0YJr
6gdsJOKeajg52O/qVkvsjjU/oByBUzk9RVXas4ivO1GDNQ0i/HK+gK40kK9Fq2FN
Wdfu2vKmgfqobSbNlCAY
=LDqq
-----END PGP SIGNATURE-----