[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20071226235334.GF27894@ZenIV.linux.org.uk>
Date: Wed, 26 Dec 2007 23:53:34 +0000
From: Al Viro <viro@...IV.linux.org.uk>
To: Dhananjay Phadke <dhananjay@...xen.com>
Cc: netdev@...r.kernel.org, jeff@...zik.org
Subject: Re: [patch 7/7] netxen: fix byte-swapping in tx and rx
On Wed, Dec 26, 2007 at 03:29:22PM -0800, Dhananjay Phadke wrote:
> 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.
Fair enough; AFAICS, on rx side you don't mess with conversion in
place and single le64_to_cpu() into a local variable is sane.
BTW,
+ u64 value = le64_to_cpu((status_desc)->status_desc_data); \
+ value &= ~(0x3ULL << 56); \
+ value |= (u64)(((u64)(val) << 56) & (0x3ULL << 56)); \
+ (status_desc)->status_desc_data = cpu_to_le64(value); \
would be better off as
status_desc->status_desc_data =
status_desc->status_desc_data &
cpu_to_le64(3ULL << 56) |
cpu_to_le64(((u64)val & 3) << 56);
since the second term will be constant and you get one conversion instead
of two (and if val is constant, you'll get no conversions at all, just
one and + one or)
--
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