2011-09-08 05:42:04

by Semigod King

[permalink] [raw]
Subject: mac80211 driver for RT3070 wifi card does not work on big-endian platform

Greetings,

I would like to report a bug to you. The same problem was reported to
OpenWRT developers. But, they suggest me report it to linux wireless.

Problem:
The wireless card can not be recognized. But, an iface with wrong MAC
is created.

wlan1 Link encap:Ethernet HWaddr 00:06:4E:E8:00:00 <== Wrong MAC, the
correct MAC is E8:4E:06:00:74:61. Looks like byte-swapped.
UP BROADCAST MULTICAST MTU:1500 Metric:1 <=== Not running
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

After making changes according to
https://forum.openwrt.org/viewtopic.php?id=30132,
the card can now be recognized with correct MAC and can be operated.
But, it does not work yet.
No RX in AP mode. No TX & RX in STA mode. I guess the TX in AP mode is
meaningless.


Wifi Card: Unknown brand, RT3070 chipset, USB
Platform: Openwrt (MIPS, BCM6358, big-endian)
Kernel:
root@OpenWrt:~# uname -a
Linux OpenWrt 2.6.39.4 #1 Mon Aug 22 04:57:19 MST 2011 mips GNU/Linux
driver: mac80211 compat-wireless driver.
kmod-rt2800-lib - 2.6.39.4+2011-08-10-2
kmod-rt2800-usb - 2.6.39.4+2011-08-10-2
kmod-rt2x00-lib - 2.6.39.4+2011-08-10-2
kmod-rt2x00-usb - 2.6.39.4+2011-08-10-2



Regards,
Lucas Wang


2011-09-08 15:12:46

by Larry Finger

[permalink] [raw]
Subject: Re: mac80211 driver for RT3070 wifi card does not work on big-endian platform

On 09/08/2011 12:34 AM, Semigod King wrote:
> Greetings,
>
> I would like to report a bug to you. The same problem was reported to
> OpenWRT developers. But, they suggest me report it to linux wireless.
>
> Problem:
> The wireless card can not be recognized. But, an iface with wrong MAC
> is created.
>
> wlan1 Link encap:Ethernet HWaddr 00:06:4E:E8:00:00<== Wrong MAC, the
> correct MAC is E8:4E:06:00:74:61. Looks like byte-swapped.
> UP BROADCAST MULTICAST MTU:1500 Metric:1<=== Not running
> RX packets:0 errors:0 dropped:0 overruns:0 frame:0
> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
>
> After making changes according to
> https://forum.openwrt.org/viewtopic.php?id=30132,
> the card can now be recognized with correct MAC and can be operated.
> But, it does not work yet.
> No RX in AP mode. No TX& RX in STA mode. I guess the TX in AP mode is
> meaningless.
>
>
> Wifi Card: Unknown brand, RT3070 chipset, USB
> Platform: Openwrt (MIPS, BCM6358, big-endian)
> Kernel:
> root@OpenWrt:~# uname -a
> Linux OpenWrt 2.6.39.4 #1 Mon Aug 22 04:57:19 MST 2011 mips GNU/Linux
> driver: mac80211 compat-wireless driver.
> kmod-rt2800-lib - 2.6.39.4+2011-08-10-2
> kmod-rt2800-usb - 2.6.39.4+2011-08-10-2
> kmod-rt2x00-lib - 2.6.39.4+2011-08-10-2
> kmod-rt2x00-usb - 2.6.39.4+2011-08-10-2

Obviously, that driver fails to work on a big-endian platform. For tracking
purposes, please open a bug report at bugzilla.kernel.org. That will also be a
location for exchanging trial patches.

I have an RT3090 USB device and a MacBook G4 that uses the PPC processor, thus I
have a test bed for investigating this problem.

Larry

2011-09-09 00:29:07

by Larry Finger

[permalink] [raw]
Subject: Re: mac80211 driver for RT3070 wifi card does not work on big-endian platform

On 09/08/2011 12:34 AM, Semigod King wrote:
> Greetings,
>
> I would like to report a bug to you. The same problem was reported to
> OpenWRT developers. But, they suggest me report it to linux wireless.

I do see a problem. Looking at one piece of your patch, we see

- rt2800_register_read_lock(rt2x00dev, EFUSE_DATA3,
- (u32 *)&rt2x00dev->eeprom[i]);
+ rt2800_register_read_lock(rt2x00dev, EFUSE_DATA3, &reg);
+ *(u32 *)&rt2x00dev->eeprom[i] = le32_to_cpu(reg);

The last statement of rt2800_register_read_lock() does an le32_to_cpu()
conversion of the output value (3rd argument), but rt2x00dev->eeprom is le16,
which is why a double conversion le32 => be32 => le32 is needed. Your second
line should be

*(u32 *)&rt2x00dev->eeprom[i] = cpu_to_le32(reg);

That does the same thing, but makes it clearer what is happening.

I am having to rebuild the Ubuntu system on my Mac, which will take a while.
When that is done, I will be able to test.

Larry