netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <weiyang@linux.vnet.ibm.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, gideonn@mellanox.com,
	Wei Yang <weiyang@linux.vnet.ibm.com>,
	Eric Dumazet <edumazet@google.com>,
	Amir Vadai <amirv@mellanox.com>
Subject: [PATCH net] net/mlx4_en: correct the endianness of doorbell_qpn on big endian platform
Date: Sun, 30 Nov 2014 10:43:51 +0800	[thread overview]
Message-ID: <1417315431-16761-1-git-send-email-weiyang@linux.vnet.ibm.com> (raw)

In commit 6a4e812 (net/mlx4_en: Avoid calling bswap in tx fast path), we store
doorbell_qpn in big endian to avoid bswap(). Then we try to write it directly
by iowrite32() instead of iowrite32be().

This works fine on little endian platform, while has some problem on big
endian platform. Here is the definition in general:

	#define iowrite32(v, addr)	writel((v), (addr))
	#define writel(b,addr)		__raw_writel(__cpu_to_le32(b),addr)

On little endian platform, the value is not swapped before write. While on big
endian platform, the value is swapped. This is not expected to happen.

This patch does the swap on big endian platform before it is written.

Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
CC: Eric Dumazet <edumazet@google.com>
CC: Amir Vadai <amirv@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_tx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 454d9fe..76f028b 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -954,7 +954,7 @@ 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,
+			iowrite32(__cpu_to_le32(ring->doorbell_qpn),
 				  ring->bf.uar->map + MLX4_SEND_DOORBELL);
 		} else {
 			ring->xmit_more++;
-- 
1.7.9.5

             reply	other threads:[~2014-11-30  2:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-30  2:43 Wei Yang [this message]
2014-11-30  2:52 ` [PATCH net] net/mlx4_en: correct the endianness of doorbell_qpn on big endian platform Wei Yang
2014-11-30 19:27 ` Eric Dumazet
2014-12-01  1:29   ` Wei Yang
2014-12-06  5:31 ` David Miller
2014-12-06  5:46   ` Eric Dumazet
2014-12-08  3:12     ` Wei Yang
2014-12-08 10:00     ` David Laight
2014-12-08 14:42       ` Wei Yang
2014-12-13  3:13         ` Wei Yang
2014-12-14  4:43           ` David Miller
2014-12-15  1:32             ` Wei Yang
2014-12-15  9:59               ` Amir Vadai
2014-12-15 10:00               ` 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=1417315431-16761-1-git-send-email-weiyang@linux.vnet.ibm.com \
    --to=weiyang@linux.vnet.ibm.com \
    --cc=amirv@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gideonn@mellanox.com \
    --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 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).