All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: 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 22:38:03 +0000	[thread overview]
Message-ID: <20071226223803.GE27894@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20071226182928.425988922@netxen.com>

On Wed, Dec 26, 2007 at 10:23:59AM -0800, dhananjay@netxen.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.

  reply	other threads:[~2007-12-26 22:38 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 [this message]
2007-12-26 23:29     ` Dhananjay Phadke
2007-12-26 23:53       ` Al Viro
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=20071226223803.GE27894@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.