From: "Tomas Winkler" <tomasw@gmail.com>
To: "Senthilkumar Balasubramanian"
<Senthilkumar.Balasubramanian@atheros.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
"johannes@sipsolutions.net" <johannes@sipsolutions.net>,
"ron.rindjunsky@intel.com" <ron.rindjunsky@intel.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"Luis Rodriguez" <Luis.Rodriguez@atheros.com>
Subject: Re: [PATCH] mac80211: fix alignment issue with compare_ether_addr()
Date: Wed, 28 May 2008 21:09:31 +0300 [thread overview]
Message-ID: <1ba2fa240805281109m217b3d66t1b023ea43cb82ee6@mail.gmail.com> (raw)
In-Reply-To: <44EE5C37ADC36343B0625A05DD408C483351723448@CHEXMB-01.global.atheros.com>
On Wed, May 28, 2008 at 8:33 PM, Senthilkumar Balasubramanian
<Senthilkumar.Balasubramanian@atheros.com> wrote:
>
> ________________________________________
> From: Tomas Winkler [tomasw@gmail.com]
> Sent: Wednesday, May 28, 2008 10:37 PM
> To: Senthilkumar Balasubramanian
> Cc: John W. Linville; johannes@sipsolutions.net; ron.rindjunsky@intel.com; linux-wireless@vger.kernel.org; Luis Rodriguez
> Subject: Re: [PATCH] mac80211: fix alignment issue with compare_ether_addr()
>
> On Wed, May 28, 2008 at 7:50 PM, Senthilkumar Balasubramanian
> <Senthilkumar.Balasubramanian@atheros.com> wrote:
>> ________________________________________
>> From: John W. Linville [linville@tuxdriver.com]
>> Sent: Wednesday, May 28, 2008 8:46 PM
>> To: Senthilkumar Balasubramanian
>> Cc: johannes@sipsolutions.net; ron.rindjunsky@intel.com; linux-wireless@vger.kernel.org; Luis Rodriguez
>> Subject: Re: [PATCH] mac80211: fix alignment issue with compare_ether_addr()
>>
>> On Wed, May 28, 2008 at 08:20:48PM +0530, Senthil Balasubramanian wrote:
>>> This addresses an alignment issue with compare_ether_addr().
>>> The addresses passed to compare_ether_addr should be two bytes aligned.
>>> It may function properly in x86 platform. However may not work properly
>>> on IA-64 or ARM processor.
>>
>>> --- a/net/mac80211/rx.c
>>> +++ b/net/mac80211/rx.c
>>> @@ -1116,7 +1116,9 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
>>> u16 fc, hdrlen, ethertype;
>>> u8 *payload;
>>> u8 dst[ETH_ALEN];
>>> - u8 src[ETH_ALEN];
>>> + /* Should be aligned on 2 bytes for compare_ether_addr() */
>>> + u16 src_aligned[ETH_ALEN >> 1];
>>> + u8 *src = (u8 *)src_aligned;
>>> struct sk_buff *skb = rx->skb;
>>> struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
>>> DECLARE_MAC_BUF(mac);
>>
>> Any reason you couldn't just do this?
>>
>> I just thought of using the type u16 instead of attribute here. that's all. No specific reason.
>>
>> @@ -1116,7 +1116,7 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
>> u16 fc, hdrlen, ethertype;
>> u8 *payload;
>> u8 dst[ETH_ALEN];
>> - u8 src[ETH_ALEN];
>> + u8 src[ETH_ALEN] __attribute__ ((aligned(2)));
>> struct sk_buff *skb = rx->skb;
>> struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
>> DECLARE_MAC_BUF(mac);
>>
>> It seems to compile w/o errors on i686, and it seems more clear to me.
>> Will that not work?
>>
>> Yes. It should also work. I will re-create the patch and send it to you. I will also include Johannes suggestion of just using __aligned macro.
>>
> Can we split the two issues in seperate patches. It's better for tracking.
>
> They are not two different issues. All of them addresses the same alignment issue only. Initially I thought of using u16 to get it aligned on 2 byte and then I started using the attribute stuff as in page_group_addr[] and others required initializations for the u8 array.
>
I mean reordering buffer allocation and alignment are not the same issues.
Thanks
Tomas
next prev parent reply other threads:[~2008-05-28 18:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-28 14:50 [PATCH] mac80211: fix alignment issue with compare_ether_addr() Senthil Balasubramanian
2008-05-28 15:16 ` John W. Linville
2008-05-28 16:42 ` Johannes Berg
2008-05-28 16:50 ` Senthilkumar Balasubramanian
2008-05-28 17:07 ` Tomas Winkler
2008-05-28 17:33 ` Senthilkumar Balasubramanian
2008-05-28 18:09 ` Tomas Winkler [this message]
2008-05-28 15:34 ` Johannes Berg
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=1ba2fa240805281109m217b3d66t1b023ea43cb82ee6@mail.gmail.com \
--to=tomasw@gmail.com \
--cc=Luis.Rodriguez@atheros.com \
--cc=Senthilkumar.Balasubramanian@atheros.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=ron.rindjunsky@intel.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