From: Larry Finger <Larry.Finger@lwfinger.net>
To: Semigod King <semigodking@gmail.com>
Cc: wireless <linux-wireless@vger.kernel.org>
Subject: Re: mac80211 driver for RT3070 wifi card does not work on big-endian platform
Date: Wed, 14 Sep 2011 16:22:03 -0500 [thread overview]
Message-ID: <4E711AFB.7030806@lwfinger.net> (raw)
In-Reply-To: <CA+TXxM23gnbt5JG+s0QTCFm0Ljcc8nZnXH9PNkBaqqhBwMcVYA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1133 bytes --]
On 09/09/2011 12:30 PM, Semigod King wrote:
> I noticed two lines of code:
> static const u32 wcid[2] = { 0xffffffff, 0x00ffffff };
> rt2800_register_multiwrite(rt2x00dev, MAC_WCID_ENTRY(i),
> wcid, sizeof(wcid));
>
> Do you think the first line should be changed as below to eliminate
> platform difference?
> static const u32 wcid[2] = { 0xffffffff,
> cpu_to_le32(0x00ffffff) };
No, that kind of thing should not be done. Internal data that are not
specifically set to be little- or big-endian should be in cpu order. The
conversions need to be done when writing to or reading from the device when the
order differs from that of the cpu.
The changes were minimal. Most of the time it took me were in getting Linux
running on my Powerbook G4 and getting the code to compile - I had to work
around a bug in gcc version 4.4.5 on the PowerMac platform. The patch I needed
is attached. The performance of rt2800usb is not great. With netperf, I'm
getting about 5 Mbps for the netperf MAERTS, STREAM, and SENDFILE tests.
Larry
[-- Attachment #2: rt2x00_big_endian --]
[-- Type: text/plain, Size: 2331 bytes --]
Index: wireless-testing-new/drivers/net/wireless/rt2x00/rt2800lib.c
===================================================================
--- wireless-testing-new.orig/drivers/net/wireless/rt2x00/rt2800lib.c 2011-09-14 15:25:01.595735348 -0500
+++ wireless-testing-new/drivers/net/wireless/rt2x00/rt2800lib.c 2011-09-14 15:25:09.291644646 -0500
@@ -3697,14 +3697,15 @@
rt2800_regbusy_read(rt2x00dev, EFUSE_CTRL, EFUSE_CTRL_KICK, ®);
/* Apparently the data is read from end to start */
- rt2800_register_read_lock(rt2x00dev, EFUSE_DATA3,
- (u32 *)&rt2x00dev->eeprom[i]);
- rt2800_register_read_lock(rt2x00dev, EFUSE_DATA2,
- (u32 *)&rt2x00dev->eeprom[i + 2]);
- rt2800_register_read_lock(rt2x00dev, EFUSE_DATA1,
- (u32 *)&rt2x00dev->eeprom[i + 4]);
- rt2800_register_read_lock(rt2x00dev, EFUSE_DATA0,
- (u32 *)&rt2x00dev->eeprom[i + 6]);
+ rt2800_register_read_lock(rt2x00dev, EFUSE_DATA3, ®);
+ /* The returned value is in CPU order, but eeprom is le */
+ rt2x00dev->eeprom[i] = cpu_to_le32(reg);
+ rt2800_register_read_lock(rt2x00dev, EFUSE_DATA2, ®);
+ *(u32 *)&rt2x00dev->eeprom[i + 2] = cpu_to_le32(reg);
+ rt2800_register_read_lock(rt2x00dev, EFUSE_DATA1, ®);
+ *(u32 *)&rt2x00dev->eeprom[i + 4] = cpu_to_le32(reg);
+ rt2800_register_read_lock(rt2x00dev, EFUSE_DATA0, ®);
+ *(u32 *)&rt2x00dev->eeprom[i + 6] = cpu_to_le32(reg);
mutex_unlock(&rt2x00dev->csr_mutex);
}
@@ -3870,19 +3872,23 @@
return -ENODEV;
}
- if (!rt2x00_rf(rt2x00dev, RF2820) &&
- !rt2x00_rf(rt2x00dev, RF2850) &&
- !rt2x00_rf(rt2x00dev, RF2720) &&
- !rt2x00_rf(rt2x00dev, RF2750) &&
- !rt2x00_rf(rt2x00dev, RF3020) &&
- !rt2x00_rf(rt2x00dev, RF2020) &&
- !rt2x00_rf(rt2x00dev, RF3021) &&
- !rt2x00_rf(rt2x00dev, RF3022) &&
- !rt2x00_rf(rt2x00dev, RF3052) &&
- !rt2x00_rf(rt2x00dev, RF3320) &&
- !rt2x00_rf(rt2x00dev, RF5370) &&
- !rt2x00_rf(rt2x00dev, RF5390)) {
- ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
+ switch (rt2x00dev->chip.rf) {
+ case RF2820:
+ case RF2850:
+ case RF2720:
+ case RF2750:
+ case RF3020:
+ case RF2020:
+ case RF3021:
+ case RF3022:
+ case RF3052:
+ case RF3320:
+ case RF5370:
+ case RF5390:
+ break;
+ default:
+ ERROR(rt2x00dev, "Invalid RF chipset 0x%x detected.\n",
+ rt2x00dev->chip.rf);
return -ENODEV;
}
next prev parent reply other threads:[~2011-09-14 21:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-08 5:34 mac80211 driver for RT3070 wifi card does not work on big-endian platform Semigod King
2011-09-08 15:12 ` Larry Finger
2011-09-08 19:04 ` Larry Finger
[not found] ` <CA+TXxM0EOBs2x+6jh=0uwDTMTUD+9ZXQ8W-ZR+=TjSARV3kAeQ@mail.gmail.com>
2011-09-09 13:55 ` Larry Finger
2011-09-09 17:30 ` Semigod King
2011-09-14 21:22 ` Larry Finger [this message]
2011-09-16 7:12 ` Semigod King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E711AFB.7030806@lwfinger.net \
--to=larry.finger@lwfinger.net \
--cc=linux-wireless@vger.kernel.org \
--cc=semigodking@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).