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 [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to