mac80211: ad-hoc and master

Live forum: http://rt2x00.serialmonkey.com/viewtopic.php?t=4632

vitja

23-02-2008 07:08:22

Hi, all!

I downloaded rt2x00 git, and found, that beaconing will not work with rt73
and all others. First of all rt2x00lib_beacondone() that shedules becon generation is never called in rt2400pci it is called from interrupt handler.
The next step I made was to call rt2x00lib_beacondone() somewhere
after interface is up. But this doesn't help as ieee80211_beacon_get()
wouldn't work with ADHOC mode and return NULL, btw in master mode it returns NULL too, maybe I'm setting master mode wrong way.

With rt73 legacy ad-hoc mode works just fine, also I found that it will
work if beacon is queued just once.

So as I understand that's okay with hardware the problem is mostly in brand new mac80211 stack, that mostly support managed mode.

Also one question, is there difference between ad-hoc and master mode
at phy level, or just at MAC. So for example if I'll set AP mode in beacon frame, will it work as AP, or some extra HW settings are required?

also I want to report success on running rt73-legacy driver on bfin
with isp1362 usb controller. There are memory alignment issues with rt2x00, about rt2x00_desc_(read|write).

Thanks,
vitja.

IvD

23-02-2008 11:19:12


I downloaded rt2x00 git, and found, that beaconing will not work with rt73
and all others. First of all rt2x00lib_beacondone() that shedules becon generation is never called in rt2400pci it is called from interrupt handler.
[/quote29r8umga]

If beacons are required mac80211 passes the beacon to rt2x00. rt2x00 should not call ieee80211_beacon_get() manually to start beaconing.


The next step I made was to call rt2x00lib_beacondone() somewhere
after interface is up. But this doesn't help as ieee80211_beacon_get()
wouldn't work with ADHOC mode and return NULL, btw in master mode it returns NULL too, maybe I'm setting master mode wrong way.
[/quote29r8umga]

Same reason, if mac80211 doesn't want rt2x00 to beacon, then it won't provide any beacons.


With rt73 legacy ad-hoc mode works just fine, also I found that it will
work if beacon is queued just once.
[/quote29r8umga]

right, and since rt73usb does not use ieee80211_beacon_get() every beacon interval would suggest it follows the expected behavior.


Also one question, is there difference between ad-hoc and master mode
at phy level, or just at MAC. So for example if I'll set AP mode in beacon frame, will it work as AP, or some extra HW settings are required?
[/quote29r8umga]

There are some few register tweaks I believe.


also I want to report success on running rt73-legacy driver on bfin
with isp1362 usb controller. There are memory alignment issues with rt2x00, about rt2x00_desc_(read|write).[/quote29r8umga]

What kind of memory alignment issues?

vitja

23-02-2008 12:55:18

How can I ask mac80211 to send beacons? I think that when ad-hoc mode is set and iface is up they should go on, am I wrong here, (add_beacon() should be called from user space)? But from the other side this should not work for Ad-Hoc as ieee80211_beacon_get() work only with IEEE80211_IF_TYPE_AP. Point me if I'm wrong.

Has anyone ran rt2x00 in AP mode? I tried to modify beacon for that,
and it was seen as device in master mode, but I couldn't associate.

Blackfin problem is that rt2x00_desc_read() causes core exception
unaligned memory access 32-bit address is not aligned to 4 but to 2.
I tried to replace direct writes with (put|get)_unaligned one, and it helped only when I made this functions ordinary, not inlined. I'll tell you more later.

IvD

23-02-2008 13:00:47

How can I ask mac80211 to send beacons? I think that when ad-hoc mode is set and iface is up they should go on, am I wrong here, (add_beacon() should be called from user space)? But from the other side this should not work for Ad-Hoc as ieee80211_beacon_get() work only with IEEE80211_IF_TYPE_AP. Point me if I'm wrong.
[/quote1pycvkfc]

Well I am not sure how mac80211 handles beacons, so I can't say much else about it except that mac80211 must tell the driver to use beacons.


Has anyone ran rt2x00 in AP mode? I tried to modify beacon for that,
and it was seen as device in master mode, but I couldn't associate.
[/quote1pycvkfc]

There are various topics on this forum about it, just search this forum.


Blackfin problem is that rt2x00_desc_read() causes core exception
unaligned memory access 32-bit address is not aligned to 4 but to 2.
I tried to replace direct writes with (put|get)_unaligned one, and it helped only when I made this functions ordinary, not inlined. I'll tell you more later.[/quote1pycvkfc]

This sounds a bit weird...

vitja

29-02-2008 20:26:17

Why don't you use, HW_BEACON_BASE0 one for transmitting beacons,
as for example is made in openbsd driver if_rum.

if_rum can act as AP.

IvD

29-02-2008 20:35:18

Ehm, I believe this entire discussion was about how mac80211 provides the beacon to rt2x00. Not about how rt2x00 sends the beacon.
Does if_rum have an entire 80211 stack inside the driver which allows it to directly create the beacon into the register?
I seriously doubt that, they too will have a stack that provides a beacon.

Have you even looked into the rt2x00 code? Apparenly not, since HW_BEACON_BASE0 _is_ used for transmitting beacons. But like I already mentioned, that fact isn't even under discussion (yet).

vitja

01-03-2008 05:18:32

Sorry, it really uses HW_BEACON_BASE0.
Here is little patch attached, it fixes 'alignment issues on bfin', it occurs when desc address is aligned to 2 but not to 4. on i386 get_unaligned do nothing.

IvD

01-03-2008 12:22:12


Here is little patch attached, it fixes 'alignment issues on bfin', it occurs when desc address is aligned to 2 but not to 4. on i386 get_unaligned do nothing.[/quotee06i2678]

How can a descriptor be aligned to 2 bytes?
The descriptor is read directly from the start of the allocated DMA buffer, and uses a multiple of 4 bytes offset each time.
So either the DMA allocation is broken by allocating something on a 2 byte boundrary, or something else is going wrong...

vitja

01-03-2008 13:25:14

How can a descriptor be aligned to 2 bytes?
The descriptor is read directly from the start of the allocated DMA buffer, and uses a multiple of 4 bytes offset each time.
So either the DMA allocation is broken by allocating something on a 2 byte boundrary, or something else is going wrong...[/quote1zuu38wz]


Actually it fails at rt73usb_fill_rxdone, where rxd is entry->skb->data,
so somewhy it's not aligned. Can the problem be herert73usb.c1400?

vitja.

IvD

01-03-2008 16:33:03

Hmm true, I think that get_unaligned however is too much impact. (That function can be quite big on platforms that really need it).
I think it is easier to fix this in the driver by doing something like

* if descriptor comes after frame, move it to before to the frame (for rt2500usb)
* if data is unaligned, insert 2 bytes between start of header and descriptor

That way the descriptor is always at the start of the buffer, and correctly aligned.

IvD

01-03-2008 18:28:35

Fixed in latest rt2x00.git.