From: Al Viro <viro@ZenIV.linux.org.uk>
To: Dhananjay Phadke <dhananjay@netxen.com>
Cc: netdev@vger.kernel.org, jeff@garzik.org
Subject: Re: [patch 7/7] netxen: fix byte-swapping in tx and rx
Date: Wed, 26 Dec 2007 23:53:34 +0000 [thread overview]
Message-ID: <20071226235334.GF27894@ZenIV.linux.org.uk> (raw)
In-Reply-To: <Pine.LNX.4.64.0712261525490.23059@dut46.unminc.com>
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)
next prev parent reply other threads:[~2007-12-26 23:53 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-26 18:23 [patch 0/7] netxen bug fixes dhananjay
2007-12-26 18:23 ` [patch 1/7] netxen: update MAINTAINERS dhananjay
2008-01-12 22:36 ` Jeff Garzik
2007-12-26 18:23 ` [patch 2/7] netxen: update driver version dhananjay
2007-12-26 18:23 ` [patch 3/7] netxen: improve MSI interrupt handling dhananjay
2008-01-12 22:37 ` Jeff Garzik
2007-12-26 18:23 ` [patch 4/7] netxen: stop second phy correctly dhananjay
2008-01-12 22:37 ` Jeff Garzik
2007-12-26 18:23 ` [patch 5/7] netxen: fix race in interrupt / napi dhananjay
2008-01-12 22:38 ` Jeff Garzik
2008-01-14 18:00 ` Dhananjay Phadke
2007-12-26 18:23 ` [patch 6/7] netxen: optimize tx handling dhananjay
2008-01-12 22:38 ` Jeff Garzik
2007-12-26 18:23 ` [patch 7/7] netxen: fix byte-swapping in tx and rx dhananjay
2007-12-26 22:38 ` Al Viro
2007-12-26 23:29 ` Dhananjay Phadke
2007-12-26 23:53 ` Al Viro [this message]
2007-12-31 18:08 ` Dhananjay Phadke
2008-01-12 22:38 ` Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071226235334.GF27894@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=dhananjay@netxen.com \
--cc=jeff@garzik.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.