netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Amir Vadai <amirv@mellanox.com>, "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Or Gerlitz <ogerlitz@mellanox.com>,
	Yevgeny Petrilin <yevgenyp@mellanox.com>,
	Wei Yang <weiyang@linux.vnet.ibm.com>,
	David Laight <david.laight@aculab.com>
Subject: Re: [PATCH net] net/mlx4_en: Doorbell is byteswapped in Little Endian archs
Date: Sun, 21 Dec 2014 22:53:50 +0300	[thread overview]
Message-ID: <5497254E.6090603@cogentembedded.com> (raw)
In-Reply-To: <1419185938-28987-1-git-send-email-amirv@mellanox.com>

Hello.

On 12/21/2014 9:18 PM, Amir Vadai wrote:

> iowrite32() will byteswap it's argument on big endian archs.
> iowrite32be() will byteswap on little endian archs.
> Since we don't want to do this unnecessary byteswap on the fast path,
> doorbell is stored in the NIC's native endianness. Using the right
> iowrite() according to the arch endianness.

> CC: Wei Yang <weiyang@linux.vnet.ibm.com>
> CC: David Laight <david.laight@aculab.com>
> Fixes: 6a4e812 ("net/mlx4_en: Avoid calling bswap in tx fast path")
> Signed-off-by: Amir Vadai <amirv@mellanox.com>
> ---
>   drivers/net/ethernet/mellanox/mlx4/en_tx.c | 11 ++++++++++-
>   1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> index a308d41..6477cc7 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> @@ -962,7 +962,16 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
>   		tx_desc->ctrl.owner_opcode = op_own;
>   		if (send_doorbell) {
>   			wmb();
> -			iowrite32(ring->doorbell_qpn,
> +		/* Since there is no iowrite*_native() that writes the value
> +		 * as is, without byteswapping - using the one the doesn't do
> +		 * byteswapping in the relevant arch endianness.
> +		 */

    Why the comment is not aligned with the code?

> +#if defined(__LITTLE_ENDIAN)
> +			iowrite32(
> +#else
> +			iowrite32be(
> +#endif

    Ugh...

> +				  ring->doorbell_qpn,
>   				  ring->bf.uar->map + MLX4_SEND_DOORBELL);
[...]

WBR, Sergei

  reply	other threads:[~2014-12-21 19:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-21 18:18 [PATCH net] net/mlx4_en: Doorbell is byteswapped in Little Endian archs Amir Vadai
2014-12-21 19:53 ` Sergei Shtylyov [this message]
2014-12-22  8:17   ` Amir Vadai
2015-01-05  9:46 ` David Laight

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=5497254E.6090603@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=amirv@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=david.laight@aculab.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=weiyang@linux.vnet.ibm.com \
    --cc=yevgenyp@mellanox.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).