Re: wireless vs. alignment requirements

2007-11-29 Thread H. Peter Anvin
Herbert Xu wrote: On Thu, Nov 29, 2007 at 04:28:34PM -0800, H. Peter Anvin wrote: sky2 is the exception here, not the rule. It is, but it's not unique. Several USB adapters have the same problem, for example. Notice the common theme here that slow (or slower, i.e., certainly nowhere near 10G

Re: wireless vs. alignment requirements

2007-11-29 Thread Herbert Xu
On Thu, Nov 29, 2007 at 04:28:34PM -0800, H. Peter Anvin wrote: > > >sky2 is the exception here, not the rule. > > It is, but it's not unique. Several USB adapters have the same problem, > for example. Notice the common theme here that slow (or slower, i.e., certainly nowhere near 10Gb) NICs ar

Re: wireless vs. alignment requirements

2007-11-29 Thread H. Peter Anvin
Herbert Xu wrote: On Thu, Nov 29, 2007 at 09:50:35AM -0800, H. Peter Anvin wrote: Uhm, most cards affected *ARE* Ethernet cards, due to the bloody 14-byte header. Well most Ethernet drivers are using NET_IP_ALIGN which means that IP stack gets aligned packets only. sky2 is the exception here,

Re: wireless vs. alignment requirements

2007-11-29 Thread Herbert Xu
On Thu, Nov 29, 2007 at 09:50:35AM -0800, H. Peter Anvin wrote: > > Uhm, most cards affected *ARE* Ethernet cards, due to the bloody 14-byte > header. Well most Ethernet drivers are using NET_IP_ALIGN which means that IP stack gets aligned packets only. sky2 is the exception here, not the rule.

Re: wireless vs. alignment requirements

2007-11-29 Thread H. Peter Anvin
Herbert Xu wrote: On Tue, Nov 27, 2007 at 09:16:07AM -0800, H. Peter Anvin wrote: I wrote a patch for the IP stack to realign packets if necessary at one point. I should dredge it up again and submit it for collective flamage. As long as it doesn't penalise Ethernet (e.g., the 10Gb crowd :) i

Re: wireless vs. alignment requirements

2007-11-29 Thread Herbert Xu
On Tue, Nov 27, 2007 at 09:16:07AM -0800, H. Peter Anvin wrote: > > I wrote a patch for the IP stack to realign packets if necessary at one > point. I should dredge it up again and submit it for collective flamage. As long as it doesn't penalise Ethernet (e.g., the 10Gb crowd :) it would be goo

Re: wireless vs. alignment requirements

2007-11-27 Thread H. Peter Anvin
Stephen Hemminger wrote: Is there any standard kernel config define for "this platform can't do unaligned accesses"? Not that I know of, but there should be. To be somewhat more complexicated, some platforms (e.g. MIPS) can do unaligned references quite cheaply, but they need different opco

Re: wireless vs. alignment requirements

2007-11-27 Thread Stephen Hemminger
On Tue, 27 Nov 2007 09:16:07 -0800 "H. Peter Anvin" <[EMAIL PROTECTED]> wrote: > Stephen Hemminger wrote: > > Herbert Xu wrote: > >> On Sat, Nov 24, 2007 at 02:49:36PM +0100, Johannes Berg wrote: > >> > >>> Right. I just didn't think that would be a valid value for an > >>> architecture to set.

Re: wireless vs. alignment requirements

2007-11-27 Thread H. Peter Anvin
Stephen Hemminger wrote: Herbert Xu wrote: On Sat, Nov 24, 2007 at 02:49:36PM +0100, Johannes Berg wrote: Right. I just didn't think that would be a valid value for an architecture to set. OK. Let me clarify this a bit more. We require at least one of the following rules to be met:

Re: wireless vs. alignment requirements

2007-11-27 Thread H. Peter Anvin
Herbert Xu wrote: Luckily all sky2 users have been on x86 so far :) Hardly so. My previous employer was MIPS and we used it there (with my patch.) -hpa - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo

Re: wireless vs. alignment requirements

2007-11-25 Thread Herbert Xu
On Sun, Nov 25, 2007 at 01:21:44PM -0800, Stephen Hemminger wrote: > > No too wasteful. I'm working a patch to eth_type_trans to realign if > needed for any device. If you're going to do that you can probably compute the checksum at the same time. Cheers, -- Visit Openswan at http://www.openswa

Re: wireless vs. alignment requirements

2007-11-25 Thread Herbert Xu
On Sun, Nov 25, 2007 at 06:04:17PM +0100, Johannes Berg wrote: > > I'd think that totally depends on the traffic. If you have a non-QoS AP > with WPS upstream connection, then the traffic to stations will be > four-byte aligned while the WPS upstream will be at a 2-byte-mod-4 > boundary. And you'll

Re: wireless vs. alignment requirements

2007-11-25 Thread Stephen Hemminger
Herbert Xu wrote: On Sat, Nov 24, 2007 at 12:11:08PM -0800, Stephen Hemminger wrote: Then what about hardware that can't dma ethernet to non-aligned address. Sky2 hardware breaks if DMA is not 8 byte aligned. IMHO the IP stack should handle any alignment, and do the appropriate memove if the

Re: wireless vs. alignment requirements

2007-11-25 Thread Johannes Berg
> > Hmm. I don't think so. Take an AP for example. It gets a lot of packets > > from stations. Now, if you're not QoS capable then all is well. But i > > you are and some stations are as well then all those stations send QoS > > packets (+2 bytes). Or take an AP connected via wireless (WPS), WPS h

Re: wireless vs. alignment requirements

2007-11-25 Thread Herbert Xu
On Sun, Nov 25, 2007 at 02:54:24PM +0100, Johannes Berg wrote: > > But I do have a choice where to fix it up and I'd prefer the drivers to > do it where necessary. For that, the warning would work because it'd > show driver authors that they need to fix something. Fair enough. > Hmm. I don't thin

Re: wireless vs. alignment requirements

2007-11-25 Thread Johannes Berg
> > Not sure. On the one hand, yeah, that's something we should probably do, > > on the other hand this will suck because for most drivers either nothing > > needs to be done or the fixup is trivial. I suppose we should do this > > but stick in a WARN_ON_ONCE() or something, at least with mac80211

Re: wireless vs. alignment requirements

2007-11-25 Thread Herbert Xu
On Sun, Nov 25, 2007 at 12:00:28PM +0100, Johannes Berg wrote: > > Not sure. On the one hand, yeah, that's something we should probably do, > on the other hand this will suck because for most drivers either nothing > needs to be done or the fixup is trivial. I suppose we should do this > but stick

Re: wireless vs. alignment requirements

2007-11-25 Thread Johannes Berg
> Sorry I was wrong about the 8 bytes requirement. Although the > IPv6 protocol does try to maintain an 8-byte alignment the Linux > stack never does anything that requires that. > > So 4 bytes is enough. Whew. Good to hear. > However, the wireless core is definitely not out of the woods. > It

Re: wireless vs. alignment requirements

2007-11-24 Thread Herbert Xu
On Sat, Nov 24, 2007 at 10:13:19PM +0100, Johannes Berg wrote: > > Eight bytes really sucks for wireless, many things are multiples of four > and QoS vs. non-QoS frames have a multiple of four and common hardware > only adds two padding bytes to get it aligned on four bytes so there's > no easy way

Re: wireless vs. alignment requirements

2007-11-24 Thread Herbert Xu
On Sat, Nov 24, 2007 at 12:11:08PM -0800, Stephen Hemminger wrote: > > Then what about hardware that can't dma ethernet to non-aligned address. > Sky2 hardware breaks if DMA is not 8 byte aligned. IMHO the IP stack should > handle any alignment, and do the appropriate memove if the CPU requires >

Re: wireless vs. alignment requirements

2007-11-24 Thread Johannes Berg
> Then what about hardware that can't dma ethernet to non-aligned address. > Sky2 hardware breaks if DMA is not 8 byte aligned. IMHO the IP stack should > handle any alignment, and do the appropriate memove if the CPU requires > alignment. Wouldn't that better be handled in the driver rather th

Re: wireless vs. alignment requirements

2007-11-24 Thread Johannes Berg
> OK. Let me clarify this a bit more. We require at least one > of the following rules to be met: > > * the IPv4/IPv6 header is aligned by 8 bytes on reception; > * or the platform provides unaligned exception handlers. > > So if your platform violates both rules then it won't work with > the

Re: wireless vs. alignment requirements

2007-11-24 Thread Stephen Hemminger
Herbert Xu wrote: On Sat, Nov 24, 2007 at 02:49:36PM +0100, Johannes Berg wrote: Right. I just didn't think that would be a valid value for an architecture to set. OK. Let me clarify this a bit more. We require at least one of the following rules to be met: * the IPv4/IPv6 header is

Re: wireless vs. alignment requirements

2007-11-24 Thread Herbert Xu
On Sat, Nov 24, 2007 at 02:49:36PM +0100, Johannes Berg wrote: > > Right. I just didn't think that would be a valid value for an > architecture to set. OK. Let me clarify this a bit more. We require at least one of the following rules to be met: * the IPv4/IPv6 header is aligned by 8 bytes on

Re: wireless vs. alignment requirements

2007-11-24 Thread David Miller
From: Johannes Berg <[EMAIL PROTECTED]> Date: Sat, 24 Nov 2007 14:49:36 +0100 > > On Sat, 2007-11-24 at 21:32 +0800, Herbert Xu wrote: > > On Sat, Nov 24, 2007 at 09:33:36AM +0100, Johannes Berg wrote: > > > > > > We still require four-byte alignment, no? > > > > Not at all. If NET_IP_ALIGN is

Re: wireless vs. alignment requirements

2007-11-24 Thread Johannes Berg
On Sat, 2007-11-24 at 21:32 +0800, Herbert Xu wrote: > On Sat, Nov 24, 2007 at 09:33:36AM +0100, Johannes Berg wrote: > > > > We still require four-byte alignment, no? > > Not at all. If NET_IP_ALIGN is zero then it won't be four-byte > aligned (since the Ethernet header is 14 bytes long). Righ

Re: wireless vs. alignment requirements

2007-11-24 Thread Ulrich Kunitz
Johannes, > Hence, going back to the 802.11 header and the IP header alignment > requirement, if we get the IP header alignment requirement right now I > cannot possibly see any way we would use compare_ether_addr() on an > address that is not at least two-byte aligned as required. ACK. I agree c

Re: wireless vs. alignment requirements

2007-11-24 Thread Herbert Xu
On Sat, Nov 24, 2007 at 09:33:36AM +0100, Johannes Berg wrote: > > We still require four-byte alignment, no? Not at all. If NET_IP_ALIGN is zero then it won't be four-byte aligned (since the Ethernet header is 14 bytes long). Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert

Re: wireless vs. alignment requirements

2007-11-24 Thread Johannes Berg
> > Now, the IP stack actually assumes that its header is four-byte aligned > > (see comment at NET_IP_ALIGN, although it is not said explicitly that > > the alignment requirement for an IP header is four) so that is actually > > something for the hardware/firmware (!) to do, for example Broadcom

Re: wireless vs. alignment requirements

2007-11-23 Thread Herbert Xu
Johannes Berg <[EMAIL PROTECTED]> wrote: > > Now, the IP stack actually assumes that its header is four-byte aligned > (see comment at NET_IP_ALIGN, although it is not said explicitly that > the alignment requirement for an IP header is four) so that is actually > something for the hardware/firmwar

wireless vs. alignment requirements

2007-11-23 Thread Johannes Berg
> David Miller found a problem in a wireless driver where I was using > compare_ether_addr() on potentially unaligned data. Document that > compare_ether_addr() is not safe for use everywhere, and add an equivalent > function that works regardless of alignment. FWIW, as I've said in the other thr