From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Yang Subject: Re: [PATCH net] net/mlx4_en: correct the endianness of doorbell_qpn on big endian platform Date: Sun, 30 Nov 2014 10:52:19 +0800 Message-ID: <20141130025218.GA17059@richard> References: <1417315431-16761-1-git-send-email-weiyang@linux.vnet.ibm.com> Reply-To: Wei Yang Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, davem@davemloft.net, gideonn@mellanox.com, Eric Dumazet , Amir Vadai To: Wei Yang Return-path: Received: from e23smtp07.au.ibm.com ([202.81.31.140]:50845 "EHLO e23smtp07.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751815AbaK3CxC (ORCPT ); Sat, 29 Nov 2014 21:53:02 -0500 Received: from /spool/local by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 30 Nov 2014 12:53:01 +1000 Received: from d23relay09.au.ibm.com (d23relay09.au.ibm.com [9.185.63.181]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id C7F6B3578023 for ; Sun, 30 Nov 2014 13:52:58 +1100 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sAU2qwTM41484444 for ; Sun, 30 Nov 2014 13:52:58 +1100 Received: from d23av01.au.ibm.com (localhost [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sAU2qvGf032197 for ; Sun, 30 Nov 2014 13:52:58 +1100 Content-Disposition: inline In-Reply-To: <1417315431-16761-1-git-send-email-weiyang@linux.vnet.ibm.com> Sender: netdev-owner@vger.kernel.org List-ID: BTW, I have one confusion in commit 6a4e812, if (ring->bf_enabled && desc_size <= MAX_BF && !bounce && !vlan_tx_tag_present(skb) && send_doorbell) { - tx_desc->ctrl.bf_qpn |= cpu_to_be32(ring->doorbell_qpn); + tx_desc->ctrl.bf_qpn = ring->doorbell_qpn | + cpu_to_be32(real_size); I am curious about why it adds an | with the real_size? I see this code pass is invoked in vlan network. I am not farmiliar with the vlan test. I guess it needs some router with vlan configuration. If you have some suggestion or link on how to test it, I am happy to have a try. On Sun, Nov 30, 2014 at 10:43:51AM +0800, Wei Yang wrote: >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 >CC: Eric Dumazet >CC: Amir Vadai >--- > 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 -- Richard Yang Help you, Help me