All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Gertjan van Wingerde
	<public-gwingerde-Re5JQEeQqe8AvxtiuMwx3w@plane.gmane.org>
Cc: rt2x00 Users List
	<public-users-poMEt7QlJxcwIE2E9O76wjtx2kNaKg5H@plane.gmane.org>,
	Benoit PAPILLAULT
	<public-benoit.papillault-GANU6spQydw@plane.gmane.org>,
	Ivo van Doorn
	<public-ivdoorn-Re5JQEeQqe8AvxtiuMwx3w@plane.gmane.org>,
	public-linux-wireless-u79uwXL29TY76Z2rM5mHXA@plane.gmane.org
Subject: Re: [rt2x00-users] [PATCH] rt2x00: Further L2 padding fixes.
Date: Sun, 29 Nov 2009 14:02:23 +0100	[thread overview]
Message-ID: <m2y6lpscv4.fsf@igel.home> (raw)
In-Reply-To: <4B125EA0.3020200@gmail.com> (Gertjan van Wingerde's message of "Sun, 29 Nov 2009 12:44:32 +0100")



Gertjan van Wingerde <gwingerde-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
writes:

> On 11/29/09 00:55, Benoit PAPILLAULT wrote:
>> Gertjan van Wingerde a écrit :
>>> On 11/28/09 22:26, Ivo van Doorn wrote:
>>>>> diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
>>>>> index b8f0954..562a344 100644
>>>>> --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
>>>>> +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
>>>>> @@ -181,7 +181,7 @@ void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length)
>>>>>  	unsigned int frame_length = skb->len;
>>>>>  	unsigned int header_align = ALIGN_SIZE(skb, 0);
>>>>>  	unsigned int payload_align = ALIGN_SIZE(skb, header_length);
>>>>> -	unsigned int l2pad = 4 - (payload_align - header_align);
>>>>> +	unsigned int l2pad = 4 - (header_length & 3);
>> 
>> Humm... is header_length = 24, then your formula gives l2pad = 4. If so,
>> this is wrong. Do I miss something?
>
> No, you are right. The formula needs another & 3 on the overall result to account for that situation.
> So, it should be:
>
> 	unsigned int l2pad = (4 - (header_length & 3)) & 3;

aka
	unsigned int l2pad = -header_length & 3;

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


      reply	other threads:[~2009-11-29 13:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-28 18:32 [PATCH] rt2x00: Further L2 padding fixes Gertjan van Wingerde
2009-11-28 21:26 ` Ivo van Doorn
2009-11-28 21:44   ` Gertjan van Wingerde
2009-11-28 23:55     ` [rt2x00-users] " Benoit PAPILLAULT
2009-11-29 11:44       ` Gertjan van Wingerde
2009-11-29 13:02         ` Andreas Schwab [this message]

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=m2y6lpscv4.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=public-benoit.papillault-GANU6spQydw@plane.gmane.org \
    --cc=public-gwingerde-Re5JQEeQqe8AvxtiuMwx3w@plane.gmane.org \
    --cc=public-ivdoorn-Re5JQEeQqe8AvxtiuMwx3w@plane.gmane.org \
    --cc=public-linux-wireless-u79uwXL29TY76Z2rM5mHXA@plane.gmane.org \
    --cc=public-users-poMEt7QlJxcwIE2E9O76wjtx2kNaKg5H@plane.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.