Hello Francois,
Thanks for the feedback! I hope we can make it work on BE systems also ;-)
Actually, it appeared I'd better think a bit more before putting all
these be/le function calls, because it seems their placement was mostly
wrong :-(
On 6/13/2006, "Francois Barre" <[EMAIL PROTECTED]> wrote:
>Well guess what : mine is BE. And you know what ? Maybe I shall not
>have left the x86 world afterall..
Well, on the other hand, your system should have the advantage of being
slightly faster on network tasks due to BE order, right? :-D
>Here are the facts :
>dmesg is spammed with
>bcm43xx_d80211: FATAL ERROR: BCM43xx_IRQ_XMIT_ERROR
>from bcm43xx_interrupt_tasklet(). This error is said to come from
>endianness issues.
Ok, it's not that bad, I didn't think it would go that far on BE system
;-)
Here is the dump of my templates (which seem to be correct):
bcm43xx_d80211: Template size: 3c
bcm43xx_d80211: Writing PLCP value: a040002
bcm43xx_d80211: Writing template value: 8000
bcm43xx_d80211: Writing template value: ffff
bcm43xx_d80211: Writing template value: ffffffff
bcm43xx_d80211: Writing template value: 15f23d
bcm43xx_d80211: Writing template value: 6f3f0015
bcm43xx_d80211: Writing template value: f23d6f3f
bcm43xx_d80211: Writing template value: 0
bcm43xx_d80211: Writing template value: 0
bcm43xx_d80211: Writing template value: 6400
bcm43xx_d80211: Writing template value: 1000007
bcm43xx_d80211: Writing template value: 4f70656e
bcm43xx_d80211: Writing template value: 57727401
bcm43xx_d80211: Writing template value: 482840b
bcm43xx_d80211: Writing template value: 16030101
bcm43xx_d80211: Writing template value: 5040102
bcm43xx_d80211: Writing template value: 0
bcm43xx_d80211: Template size: 36
bcm43xx_d80211: Writing PLCP value: 6e842b00
bcm43xx_d80211: Writing template value: 5000
bcm43xx_d80211: Writing template value: d700ffff
bcm43xx_d80211: Writing template value: ffffffff
bcm43xx_d80211: Writing template value: 15f23d
bcm43xx_d80211: Writing template value: 6f3f0015
bcm43xx_d80211: Writing template value: f23d6f3f
bcm43xx_d80211: Writing template value: 0
bcm43xx_d80211: Writing template value: 0
bcm43xx_d80211: Writing template value: 6400
bcm43xx_d80211: Writing template value: 1000007
bcm43xx_d80211: Writing template value: 4f70656e
bcm43xx_d80211: Writing template value: 57727401
bcm43xx_d80211: Writing template value: 482840b
bcm43xx_d80211: Writing template value: 16030101
bcm43xx_d80211: Templates updated
If you compare that to your dump, it appears that:
1) PLCP seems to be OK, nothing should be changed there
2) All other values are reversed, except for the 2nd and 3rd word of probe
response template (which are processed and written separately) - they are
also reversed, but also their lower two bytes are reversed.
3) I've revisited the code once more, and it looks like some of the
shm_write calls contained cpu_to_le16/32 wrongly, so I removed them.
Please find my suggested changes in the attached patch (should be applied
on the top of the original one) and check whether it solves the problems
or not.
I haven't tried to compile changed sources, but as changes are minimal,
I hope it should compile OK.
Unfortunately, I do not fully understand byte order used by all different
functions which write to SHM/template RAM, so there are still some
problems possible :-(
In the case you still receive IRQ_XMIT_ERROR, please try noticing when it
happens - just after templates are updated, or after STA is trying to
associate
(knowing this, it's possible to determine that errors were during either
beacon template or probe response template writing).
Also please consider adding some debug output at places where values are
written at SHM (namely, PLCP headers for probe responses, lengthes of
templates and SSID) - you can just dump exising values before writing,
the values to be written and the values read back after writing - in
this way you can easily tell whether things are happening correctly or
not.
In the case SHM values are wrong for PLCP headers, you will certainly
receive XMIT_ERRORs when trying to associate STA, I'm not sure about
consequences of wrong values in SSID area.
Waiting for your results ;-)
Good luck! Alexander
diff -urN bcm43xx/bcm43xx_main.c bcm43xx.new/bcm43xx_main.c
--- bcm43xx/bcm43xx_main.c 2006-06-12 21:08:01.000000000 +0000
+++ bcm43xx.new/bcm43xx_main.c 2006-06-14 21:50:38.000000000 +0000
@@ -1538,8 +1538,8 @@
2 bytes of data */
tmp = (u32)data[0] << 16;
tmp |= (u32)data[1] << 24;
- dprintk(KERN_INFO PFX "Writing template value: %x\n", cpu_to_be32(tmp));
- bcm43xx_ram_write(bcm, ram_offset, cpu_to_be32(tmp));
+ dprintk(KERN_INFO PFX "Writing template value: %x\n", swab32(tmp));
+ bcm43xx_ram_write(bcm, ram_offset, swab32(tmp));
ram_offset += 4;
for (i = 2; i < size; i += sizeof(u32)) {
@@ -1547,11 +1547,11 @@
if (i + 1 < size) tmp |= (u32)((data + i)[1]) << 8;
if (i + 2 < size) tmp |= (u32)((data + i)[2]) << 16;
if (i + 3 < size) tmp |= (u32)((data + i)[3]) << 24;
- dprintk(KERN_INFO PFX "Writing template value: %x\n", cpu_to_be32(tmp));
- bcm43xx_ram_write(bcm, ram_offset + i, cpu_to_be32(tmp));
+ dprintk(KERN_INFO PFX "Writing template value: %x\n", swab32(tmp));
+ bcm43xx_ram_write(bcm, ram_offset + i, swab32(tmp));
}
- bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, shm_size_offset, cpu_to_le16(size + 6));
+ bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, shm_size_offset, size + 6);
}
static void bcm43xx_write_beacon_template(struct bcm43xx_private *bcm,
@@ -1583,12 +1583,12 @@
++packet_time;
/* Write PLCP in two parts and timing for packet transfer */
- bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, shm_offset, cpu_to_le16(plcp.data & 0xFFFF));
- bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, shm_offset + 2, cpu_to_le16((u32)plcp.data >> 16));
- bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, shm_offset + 6, cpu_to_le16(packet_time));
+ bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, shm_offset, cpu_to_le32(plcp.data) & 0xFFFF);
+ bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, shm_offset + 2, cpu_to_le32(plcp.data) >> 16);
+ bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, shm_offset + 6, packet_time);
}
-#define IEEE80211_FC(type, stype) cpu_to_le16((type << 2) | (stype << 4))
+#define IEEE80211_FC(type, stype) ((type << 2) | (stype << 4))
/* FIXME: instead of using custom probe response template, this function
* just patches custom beacon template by:
@@ -1648,7 +1648,6 @@
tmp = 202 + (14 + FCS_LEN) * 16 / rate;
if ((14 + FCS_LEN) * 16 % rate >= rate / 2)
++tmp;
- tmp = cpu_to_le16(tmp);
dest_data[2] = tmp & 0xFF;
dest_data[3] = (tmp >> 8) & 0xFF;
@@ -1728,16 +1727,16 @@
if (i + 2 < ssid_len) tmp |= (u32)((ssid + i)[2]) << 16;
if (i + 3 < ssid_len) tmp |= (u32)((ssid + i)[3]) << 24;
- bcm43xx_shm_write32(bcm, BCM43xx_SHM_SHARED, 0x380 + i, cpu_to_le32(tmp));
+ bcm43xx_shm_write32(bcm, BCM43xx_SHM_SHARED, 0x380 + i, tmp);
}
- bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x48, cpu_to_le16(ssid_len));
+ bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x48, ssid_len);
dprintk(KERN_INFO PFX "SSID updated\n");
}
static void bcm43xx_set_beacon_int(struct bcm43xx_private *bcm, u16 beacon_int)
{
- bcm43xx_write32(bcm, 0x0188, cpu_to_le32(beacon_int << 16));
+ bcm43xx_write32(bcm, 0x0188, beacon_int << 16);
dprintk(KERN_INFO PFX "Beacon interval updated\n");
}