[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0712261525490.23059@dut46.unminc.com>
Date: Wed, 26 Dec 2007 15:29:22 -0800 (PST)
From: Dhananjay Phadke <dhananjay@...xen.com>
To: Al Viro <viro@...IV.linux.org.uk>
cc: netdev@...r.kernel.org, jeff@...zik.org
Subject: Re: [patch 7/7] netxen: fix byte-swapping in tx and rx
I agree for tx desc, the compiler would optimize.
But for rx (status) desc, I didn't like multiple le64_to_cpu()
for extracting various fields out of same status dword.
-Dhananjay
On Wed, 26 Dec 2007, Al Viro wrote:
> On Wed, Dec 26, 2007 at 10:23:59AM -0800, dhananjay@...xen.com wrote:
> > This cleans up some unnecessary byte-swapping while setting up tx and
> > interpreting rx desc. The 64 bit rx status data should be converted
> > to host endian format only once and the macros just need to extract
> > bitfields.
>
> > - (cmd_desc)->flags_opcode |= cpu_to_le16((val) & 0x7f))
> > + ((cmd_desc)->flags_opcode &= ~(0x7f), \
> > + (cmd_desc)->flags_opcode |= (val) & 0x7f)
> > #define netxen_set_cmd_desc_opcode(cmd_desc, val) \
> > - ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x3f<<7), \
> > - (cmd_desc)->flags_opcode |= cpu_to_le16(((val & 0x3f)<<7)))
> > + ((cmd_desc)->flags_opcode &= ~(0x3f<<7), \
> > + (cmd_desc)->flags_opcode |= ((val) & 0x3f) << 7)
>
> _oh_?
>
> That's actually a pessimisation and I'd rather see that conversion in
> place gone - the thing will be less brittle that way.
>
> BTW, note that cpu_to_le16() et.al. get evaluated by compiler when the
> argument is constant.
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists