Re: [PATCH net] net/mlx4_en: correct the endianness of doorbell_qpn on big endian platform
From: David Miller <davem@davemloft.net>
Date: 2014-12-06 05:26:43
From: David Miller <davem@davemloft.net>
Date: 2014-12-06 05:26:43
From: Wei Yang <redacted> Date: Sun, 30 Nov 2014 10:43:51 +0800
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 <redacted>
Guys, let's figure out what we are doing with this patch.