Hi Marcel,
The root cause is __u8 hints[2] are unaligned because of __u8 charset defined in file include/linux/irda.h:132
struct irda_device_info {
__u32 saddr; /* Address of local interface */
__u32 daddr; /* Address of remote device */
char info[22]; /* Description */
__u8 charset; /* Charset used for description */
__u8 hints[2]; /* Hint bits */
};
And code may access hints[2] as u16.
As put_unaligned/get_unaligned would set/get value through several instructions which decreases the performance. So I'd like to modify the irda_device_info instead of using put_unaligned/get_unaligned in irlmp.c/discovery.c.
I have tried
struct irda_device_info {
__u32 saddr; /* Address of local interface */
__u32 daddr; /* Address of remote device */
char info[22]; /* Description */
__u8 charset; /* Charset used for description */
__u8 reserve; /* For align data */
__u8 hints[2]; /* Hint bits */
};
It works with my irda driver. Can I modify it like this?
There are many methods to modify this structure, which method are better?
It seems u16ho is useless, I would remove them from net/irda.
I can't enable irnet, so didn't touch net/irda/irnet/irnet_irda.c.
Would you give some information about how to enable irnet?
BRs,
Graf
-----Original Message-----
From: Marcel Holtmann [mailto:marcel@holtmann.org]
Sent: Mon 5/12/2008 9:15 PM
To: Bryan Wu
Cc: samuel@sortiz.org; irda-users@lists.sourceforge.net; linux-kernel@vger.kernel.org; Graf Yang
Subject: Re: [PATCH 1/1] [net/irda]: Fix a misalign access issue.
what about net/irda/irnet/irnet_irda.c and why not also kill the u16ho
macro at the same time.
Regards
Marcel
--