> On Monday 11 December 2006 2:48 am, Nikita V. Youshchenko wrote:
>> 
>> > On Sunday 10 December 2006 1:58 pm, Nikita V. Youshchenko wrote:
>> > > +static inline void ensure_alignment(struct sk_buff *skb)
>> > > +{
>> > > +       char *pkt = skb->data;
>> > > +       int offset = NET_IP_ALIGN ? ((unsigned long)pkt - NET_IP_ALIGN) 
>> > > & 3 : 0;
>> >
>> > I suppose it's reasonable to expect that at most the low 2 bits must
>> > be zero (i.e. align to max of u32), but it just _looks_ wrong ...
>> 
>> Can't understand what do you mean by "at most the low 2 bits must be
>> zero", sorry. Could you please explain?
> 
> You're masking with magic number 0x03, which assumes that only the low 2
> bits a must be zero.  Oh, and if it's _already_ aligned you're still moving
> it...

I still can't get yout point, sorry.
Maybe we are having some terminology mismatch.

I'm *not* assuming that "only the low 2 bits a must be zero".
I'm assuming that the low two bits must be same as they are in NET_IP_ALIGN
constant. And I do move if and only if these bits on pkt and in NET_IP_ALIGN
constant are different.
And this is exactly what this patch is intended to do: to make IP header
u32-aligned, frame shoud start at address that has same 2 low
bits as NET_IP_ALIGN has.

See examples in my previous mail.


>> And there is at least 4 bytes available before pkt (that was used for
>> frame size word in urb space).
> 
> Then it's worth a comment highlighting that fact.  In the context of
> that function, it's not clear.

Sorry, but there *is* such a comment in the patch :).
Please re-read the patch :)

Nikita


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to