lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 30 Nov 2014 10:52:19 +0800
From:	Wei Yang <weiyang@...ux.vnet.ibm.com>
To:	Wei Yang <weiyang@...ux.vnet.ibm.com>
Cc:	netdev@...r.kernel.org, davem@...emloft.net, gideonn@...lanox.com,
	Eric Dumazet <edumazet@...gle.com>,
	Amir Vadai <amirv@...lanox.com>
Subject: Re: [PATCH net] net/mlx4_en: correct the endianness of doorbell_qpn
 on big endian platform

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 <weiyang@...ux.vnet.ibm.com>
>CC: Eric Dumazet <edumazet@...gle.com>
>CC: Amir Vadai <amirv@...lanox.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

-- 
Richard Yang
Help you, Help me

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ