* [PATCH] libertas: fix memory alignment problems on the blackfin
@ 2008-01-25 13:15 Holger Schurig
2008-01-25 15:46 ` Dan Williams
0 siblings, 1 reply; 13+ messages in thread
From: Holger Schurig @ 2008-01-25 13:15 UTC (permalink / raw)
To: John W. Linville; +Cc: Dan Williams, libertas-dev, linux-wireless
From: Ihar Hrachyshka <ihar.hrachyshka@promwad.com>
Fixing unaligned memory access on the blackfin architecture (maybe on the
ARM also).
Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@promwad.com>
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
Index: wireless-2.6/drivers/net/wireless/libertas/dev.h
===================================================================
--- wireless-2.6.orig/drivers/net/wireless/libertas/dev.h 2008-01-25 10:03:29.000000000 +0100
+++ wireless-2.6/drivers/net/wireless/libertas/dev.h 2008-01-25 14:03:00.000000000 +0100
@@ -349,7 +349,7 @@ struct assoc_request {
u8 channel;
u8 band;
u8 mode;
- u8 bssid[ETH_ALEN];
+ u8 bssid[ETH_ALEN] __attribute__ ((aligned (2)));
/** WEP keys */
struct enc_key wep_keys[4];
Index: wireless-2.6/drivers/net/wireless/libertas/assoc.c
===================================================================
--- wireless-2.6.orig/drivers/net/wireless/libertas/assoc.c 2008-01-25 14:03:14.000000000 +0100
+++ wireless-2.6/drivers/net/wireless/libertas/assoc.c 2008-01-25 14:03:33.000000000 +0100
@@ -12,8 +12,10 @@
#include "cmd.h"
-static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
-static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+static const u8 bssid_any[ETH_ALEN] __attribute__ ((aligned (2))) =
+ { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
+static const u8 bssid_off[ETH_ALEN] __attribute__ ((aligned (2))) =
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static int assoc_helper_essid(struct lbs_private *priv,
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] libertas: fix memory alignment problems on the blackfin
2008-01-25 13:15 Holger Schurig
@ 2008-01-25 15:46 ` Dan Williams
0 siblings, 0 replies; 13+ messages in thread
From: Dan Williams @ 2008-01-25 15:46 UTC (permalink / raw)
To: Holger Schurig; +Cc: John W. Linville, libertas-dev, linux-wireless
On Fri, 2008-01-25 at 14:15 +0100, Holger Schurig wrote:
> From: Ihar Hrachyshka <ihar.hrachyshka@promwad.com>
>
> Fixing unaligned memory access on the blackfin architecture (maybe on the
> ARM also).
>
> Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@promwad.com>
> Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
Acked-by: Dan Williams <dcbw@redhat.com>
>
> Index: wireless-2.6/drivers/net/wireless/libertas/dev.h
> ===================================================================
> --- wireless-2.6.orig/drivers/net/wireless/libertas/dev.h 2008-01-25 10:03:29.000000000 +0100
> +++ wireless-2.6/drivers/net/wireless/libertas/dev.h 2008-01-25 14:03:00.000000000 +0100
> @@ -349,7 +349,7 @@ struct assoc_request {
> u8 channel;
> u8 band;
> u8 mode;
> - u8 bssid[ETH_ALEN];
> + u8 bssid[ETH_ALEN] __attribute__ ((aligned (2)));
>
> /** WEP keys */
> struct enc_key wep_keys[4];
> Index: wireless-2.6/drivers/net/wireless/libertas/assoc.c
> ===================================================================
> --- wireless-2.6.orig/drivers/net/wireless/libertas/assoc.c 2008-01-25 14:03:14.000000000 +0100
> +++ wireless-2.6/drivers/net/wireless/libertas/assoc.c 2008-01-25 14:03:33.000000000 +0100
> @@ -12,8 +12,10 @@
> #include "cmd.h"
>
>
> -static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
> -static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
> +static const u8 bssid_any[ETH_ALEN] __attribute__ ((aligned (2))) =
> + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
> +static const u8 bssid_off[ETH_ALEN] __attribute__ ((aligned (2))) =
> + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
>
>
> static int assoc_helper_essid(struct lbs_private *priv,
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH] libertas: fix memory alignment problems on the blackfin
@ 2008-07-09 0:18 Ihar Hrachyshka
2008-07-09 0:24 ` Harvey Harrison
2008-07-09 13:21 ` Holger Schurig
0 siblings, 2 replies; 13+ messages in thread
From: Ihar Hrachyshka @ 2008-07-09 0:18 UTC (permalink / raw)
To: libertas-dev; +Cc: linux-wireless
Fixing unaligned memory access on the blackfin architecture (maybe on the ARM also).
Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@promwad.com>
---
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index 343ed38..9dbfad3 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -567,11 +567,11 @@ static int lbs_process_bss(struct bss_descriptor *bss,
pos += 8;
/* beacon interval is 2 bytes long */
- bss->beaconperiod = le16_to_cpup((void *) pos);
+ bss->beaconperiod = le16_to_cpu(get_unaligned((__le16 *)pos));
pos += 2;
/* capability information is 2 bytes long */
- bss->capability = le16_to_cpup((void *) pos);
+ bss->capability = le16_to_cpu(get_unaligned((__le16 *)pos));
lbs_deb_scan("process_bss: capabilities 0x%04x\n", bss->capability);
pos += 2;
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] libertas: fix memory alignment problems on the blackfin
2008-07-09 0:18 [PATCH] libertas: fix memory alignment problems on the blackfin Ihar Hrachyshka
@ 2008-07-09 0:24 ` Harvey Harrison
2008-07-09 6:29 ` Ihar Hrachyshka
2008-07-09 13:21 ` Holger Schurig
1 sibling, 1 reply; 13+ messages in thread
From: Harvey Harrison @ 2008-07-09 0:24 UTC (permalink / raw)
To: Ihar Hrachyshka; +Cc: libertas-dev, linux-wireless
On Wed, 2008-07-09 at 03:18 +0300, Ihar Hrachyshka wrote:
> Fixing unaligned memory access on the blackfin architecture (maybe on the ARM also).
>
There's helpers for this now: get_unaligned_le16
Cheers,
Harvey
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] libertas: fix memory alignment problems on the blackfin
2008-07-09 0:24 ` Harvey Harrison
@ 2008-07-09 6:29 ` Ihar Hrachyshka
2008-07-10 11:29 ` Dan Williams
0 siblings, 1 reply; 13+ messages in thread
From: Ihar Hrachyshka @ 2008-07-09 6:29 UTC (permalink / raw)
To: Harvey Harrison; +Cc: libertas-dev, linux-wireless
> There's helpers for this now: get_unaligned_le16
Ok, third pass - the first was in January... :)
Fixing unaligned memory access on the blackfin architecture (maybe on
the ARM also).
Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@promwad.com>
---
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index 343ed38..4b27456 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -567,11 +567,11 @@ static int lbs_process_bss(struct bss_descriptor *bss,
pos += 8;
/* beacon interval is 2 bytes long */
- bss->beaconperiod = le16_to_cpup((void *) pos);
+ bss->beaconperiod = get_unaligned_le16(pos);
pos += 2;
/* capability information is 2 bytes long */
- bss->capability = le16_to_cpup((void *) pos);
+ bss->capability = get_unaligned_le16(pos);
lbs_deb_scan("process_bss: capabilities 0x%04x\n", bss->capability);
pos += 2;
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] libertas: fix memory alignment problems on the blackfin
2008-07-09 0:18 [PATCH] libertas: fix memory alignment problems on the blackfin Ihar Hrachyshka
2008-07-09 0:24 ` Harvey Harrison
@ 2008-07-09 13:21 ` Holger Schurig
2008-07-09 20:03 ` Ihar Hrachyshka
2008-07-09 21:07 ` Ihar Hrachyshka
1 sibling, 2 replies; 13+ messages in thread
From: Holger Schurig @ 2008-07-09 13:21 UTC (permalink / raw)
To: libertas-dev; +Cc: Ihar Hrachyshka, linux-wireless
> Fixing unaligned memory access on the blackfin architecture
> (maybe on the ARM also).
You can delete the "maybe", on ARM (more specificially, on a
PXA255, which is ARMv5TE) I didn't had a problem.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] libertas: fix memory alignment problems on the blackfin
2008-07-09 13:21 ` Holger Schurig
@ 2008-07-09 20:03 ` Ihar Hrachyshka
2008-07-09 20:07 ` Johannes Berg
2008-07-10 6:41 ` Holger Schurig
2008-07-09 21:07 ` Ihar Hrachyshka
1 sibling, 2 replies; 13+ messages in thread
From: Ihar Hrachyshka @ 2008-07-09 20:03 UTC (permalink / raw)
To: Holger Schurig; +Cc: libertas-dev, Ihar Hrachyshka, linux-wireless
On Wed, Jul 9, 2008 at 4:21 PM, Holger Schurig
<hs4233@mail.mn-solutions.de> wrote:
>> Fixing unaligned memory access on the blackfin architecture
>> (maybe on the ARM also).
>
> You can delete the "maybe", on ARM (more specificially, on a
> PXA255, which is ARMv5TE) I didn't had a problem.
Ok, just blackfin. Is it a joke or should I resend the patch with
another description?..
>
> _______________________________________________
> libertas-dev mailing list
> libertas-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/libertas-dev
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] libertas: fix memory alignment problems on the blackfin
2008-07-09 20:03 ` Ihar Hrachyshka
@ 2008-07-09 20:07 ` Johannes Berg
2008-07-09 20:55 ` Ihar Hrachyshka
2008-07-10 6:41 ` Holger Schurig
1 sibling, 1 reply; 13+ messages in thread
From: Johannes Berg @ 2008-07-09 20:07 UTC (permalink / raw)
To: Ihar Hrachyshka
Cc: Holger Schurig, libertas-dev, Ihar Hrachyshka, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 793 bytes --]
On Wed, 2008-07-09 at 23:03 +0300, Ihar Hrachyshka wrote:
> On Wed, Jul 9, 2008 at 4:21 PM, Holger Schurig
> <hs4233@mail.mn-solutions.de> wrote:
> >> Fixing unaligned memory access on the blackfin architecture
> >> (maybe on the ARM also).
> >
> > You can delete the "maybe", on ARM (more specificially, on a
> > PXA255, which is ARMv5TE) I didn't had a problem.
>
> Ok, just blackfin. Is it a joke or should I resend the patch with
> another description?..
I'm sure arm has that problem too and sparc and others, but it may not
always show up because the frame might actually be aligned sometimes.
OTOH, why are you getting unaligned frames in the first place? This is
the beacon interval, so it's at a fixed modulo-two position from the
start of the frame.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] libertas: fix memory alignment problems on the blackfin
2008-07-09 20:07 ` Johannes Berg
@ 2008-07-09 20:55 ` Ihar Hrachyshka
2008-07-09 21:02 ` Johannes Berg
0 siblings, 1 reply; 13+ messages in thread
From: Ihar Hrachyshka @ 2008-07-09 20:55 UTC (permalink / raw)
To: Johannes Berg
Cc: Holger Schurig, libertas-dev, Ihar Hrachyshka, linux-wireless
On Wed, Jul 9, 2008 at 11:07 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Wed, 2008-07-09 at 23:03 +0300, Ihar Hrachyshka wrote:
>> On Wed, Jul 9, 2008 at 4:21 PM, Holger Schurig
>> <hs4233@mail.mn-solutions.de> wrote:
>> >> Fixing unaligned memory access on the blackfin architecture
>> >> (maybe on the ARM also).
>> >
>> > You can delete the "maybe", on ARM (more specificially, on a
>> > PXA255, which is ARMv5TE) I didn't had a problem.
>>
>> Ok, just blackfin. Is it a joke or should I resend the patch with
>> another description?..
>
> I'm sure arm has that problem too and sparc and others, but it may not
> always show up because the frame might actually be aligned sometimes.
>
> OTOH, why are you getting unaligned frames in the first place? This is
> the beacon interval, so it's at a fixed modulo-two position from the
> start of the frame.
Do you mean that we should add __attribute__ ((aligned (2))) for our
'bss_descriptor' structure definition rather align particular fields
at runtime?
>
> johannes
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] libertas: fix memory alignment problems on the blackfin
2008-07-09 20:55 ` Ihar Hrachyshka
@ 2008-07-09 21:02 ` Johannes Berg
0 siblings, 0 replies; 13+ messages in thread
From: Johannes Berg @ 2008-07-09 21:02 UTC (permalink / raw)
To: Ihar Hrachyshka
Cc: Holger Schurig, libertas-dev, Ihar Hrachyshka, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 1356 bytes --]
On Wed, 2008-07-09 at 23:55 +0300, Ihar Hrachyshka wrote:
> On Wed, Jul 9, 2008 at 11:07 PM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
> > On Wed, 2008-07-09 at 23:03 +0300, Ihar Hrachyshka wrote:
> >> On Wed, Jul 9, 2008 at 4:21 PM, Holger Schurig
> >> <hs4233@mail.mn-solutions.de> wrote:
> >> >> Fixing unaligned memory access on the blackfin architecture
> >> >> (maybe on the ARM also).
> >> >
> >> > You can delete the "maybe", on ARM (more specificially, on a
> >> > PXA255, which is ARMv5TE) I didn't had a problem.
> >>
> >> Ok, just blackfin. Is it a joke or should I resend the patch with
> >> another description?..
> >
> > I'm sure arm has that problem too and sparc and others, but it may not
> > always show up because the frame might actually be aligned sometimes.
> >
> > OTOH, why are you getting unaligned frames in the first place? This is
> > the beacon interval, so it's at a fixed modulo-two position from the
> > start of the frame.
>
> Do you mean that we should add __attribute__ ((aligned (2))) for our
> 'bss_descriptor' structure definition rather align particular fields
> at runtime?
Oh, no, sorry, I got confused. The firmware apparently lays out the BSS
structure in that way, I was thinking you were getting the beacon/probe
response frame itself. The patch is correct.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] libertas: fix memory alignment problems on the blackfin
2008-07-09 13:21 ` Holger Schurig
2008-07-09 20:03 ` Ihar Hrachyshka
@ 2008-07-09 21:07 ` Ihar Hrachyshka
1 sibling, 0 replies; 13+ messages in thread
From: Ihar Hrachyshka @ 2008-07-09 21:07 UTC (permalink / raw)
To: Holger Schurig; +Cc: libertas-dev, Ihar Hrachyshka, linux-wireless
On Wed, Jul 9, 2008 at 4:21 PM, Holger Schurig
<hs4233@mail.mn-solutions.de> wrote:
>> Fixing unaligned memory access on the blackfin architecture
>> (maybe on the ARM also).
>
> You can delete the "maybe", on ARM (more specificially, on a
> PXA255, which is ARMv5TE) I didn't had a problem.
As I know, ARMs are too different to say about some "generic" ARM
behavior, in memory alignment also I think.
Too be more correct, the patch fixes alignment problems on all
machines where structures aren't aligned for even addresses by
default, blackfin, arm, or anything else I don't know about.
>
> _______________________________________________
> libertas-dev mailing list
> libertas-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/libertas-dev
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] libertas: fix memory alignment problems on the blackfin
2008-07-09 20:03 ` Ihar Hrachyshka
2008-07-09 20:07 ` Johannes Berg
@ 2008-07-10 6:41 ` Holger Schurig
1 sibling, 0 replies; 13+ messages in thread
From: Holger Schurig @ 2008-07-10 6:41 UTC (permalink / raw)
To: Ihar Hrachyshka; +Cc: libertas-dev, Ihar Hrachyshka, linux-wireless
> > You can delete the "maybe", on ARM (more specificially, on a
> > PXA255, which is ARMv5TE) I didn't had a problem.
>
> Ok, just blackfin. Is it a joke or should I resend the patch
> with another description?..
It's neither a joke (I never had any problem with my embedded
device) nor do I insist that you change the commit message. From
my part you'd get an ACK (but I'm not the maintainer of this
code).
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] libertas: fix memory alignment problems on the blackfin
2008-07-09 6:29 ` Ihar Hrachyshka
@ 2008-07-10 11:29 ` Dan Williams
0 siblings, 0 replies; 13+ messages in thread
From: Dan Williams @ 2008-07-10 11:29 UTC (permalink / raw)
To: Ihar Hrachyshka; +Cc: Harvey Harrison, libertas-dev, linux-wireless
On Wed, 2008-07-09 at 09:29 +0300, Ihar Hrachyshka wrote:
> > There's helpers for this now: get_unaligned_le16
> Ok, third pass - the first was in January... :)
>
> Fixing unaligned memory access on the blackfin architecture (maybe on
> the ARM also).
>
> Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@promwad.com>
Acked-by: Dan Williams <dcbw@redhat.com>
> ---
>
> diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
> index 343ed38..4b27456 100644
> --- a/drivers/net/wireless/libertas/scan.c
> +++ b/drivers/net/wireless/libertas/scan.c
> @@ -567,11 +567,11 @@ static int lbs_process_bss(struct bss_descriptor *bss,
> pos += 8;
>
> /* beacon interval is 2 bytes long */
> - bss->beaconperiod = le16_to_cpup((void *) pos);
> + bss->beaconperiod = get_unaligned_le16(pos);
> pos += 2;
>
> /* capability information is 2 bytes long */
> - bss->capability = le16_to_cpup((void *) pos);
> + bss->capability = get_unaligned_le16(pos);
> lbs_deb_scan("process_bss: capabilities 0x%04x\n", bss->capability);
> pos += 2;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2008-07-10 11:31 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-09 0:18 [PATCH] libertas: fix memory alignment problems on the blackfin Ihar Hrachyshka
2008-07-09 0:24 ` Harvey Harrison
2008-07-09 6:29 ` Ihar Hrachyshka
2008-07-10 11:29 ` Dan Williams
2008-07-09 13:21 ` Holger Schurig
2008-07-09 20:03 ` Ihar Hrachyshka
2008-07-09 20:07 ` Johannes Berg
2008-07-09 20:55 ` Ihar Hrachyshka
2008-07-09 21:02 ` Johannes Berg
2008-07-10 6:41 ` Holger Schurig
2008-07-09 21:07 ` Ihar Hrachyshka
-- strict thread matches above, loose matches on Subject: below --
2008-01-25 13:15 Holger Schurig
2008-01-25 15:46 ` Dan Williams
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).