linux-mips
[Top] [All Lists]

[PATCH 2/2] netdev: octeon_mgmt: Fix structure layout for little-endian.

To: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Subject: [PATCH 2/2] netdev: octeon_mgmt: Fix structure layout for little-endian.
From: David Daney <ddaney.cavm@gmail.com>
Date: Wed, 19 Jun 2013 17:40:20 -0700
Cc: linux-mips@linux-mips.org, David Daney <david.daney@cavium.com>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=mkCdeayxsJmffUXWwAQuA7YPcrACWWkht2Cy6WH6lSE=; b=cZqHmMJGPWlC0m2XgivzQFTeWmFZRwiVp1T8akQFtPqVjDjbXTQmDSsPFexmRjOMGP JPy16yHfyAX2JODgbykXn9aNtn9udG/f6DG3x5nSNSCdfVH551/PnQ5t8SaFbr4sBMvQ uTWApzptIpYQBprmOhDIrmq0gNyH7uuUFAxOXgN2jJWoJlFFP9KRs/EAzAAf+UTVTSA/ juDEZd3CV2Ce2TzAwSrcwrWFtQ05mONtQLfj7EhDb3HUQZUvjcOIok8ov345VJPqPbkY oc/FW2FdeWBBypszfzza2N6wvysoUVgkFaiY6HeJrL3m/zItKrHI3ObtP66MteGqciaf zcog==
In-reply-to: <1371688820-4585-1-git-send-email-ddaney.cavm@gmail.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1371688820-4585-1-git-send-email-ddaney.cavm@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
From: David Daney <david.daney@cavium.com>

The C ABI reverses the bitfield fill order when compiled as
little-endian.

Signed-off-by: David Daney <david.daney@cavium.com>
---
 drivers/net/ethernet/octeon/octeon_mgmt.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c 
b/drivers/net/ethernet/octeon/octeon_mgmt.c
index 1ef4148..622aa75 100644
--- a/drivers/net/ethernet/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/octeon/octeon_mgmt.c
@@ -46,17 +46,25 @@
 union mgmt_port_ring_entry {
        u64 d64;
        struct {
-               u64    reserved_62_63:2;
+#define RING_ENTRY_CODE_DONE 0xf
+#define RING_ENTRY_CODE_MORE 0x10
+#ifdef __BIG_ENDIAN_BITFIELD
+               u64 reserved_62_63:2;
                /* Length of the buffer/packet in bytes */
-               u64    len:14;
+               u64 len:14;
                /* For TX, signals that the packet should be timestamped */
-               u64    tstamp:1;
+               u64 tstamp:1;
                /* The RX error code */
-               u64    code:7;
-#define RING_ENTRY_CODE_DONE 0xf
-#define RING_ENTRY_CODE_MORE 0x10
+               u64 code:7;
                /* Physical address of the buffer */
-               u64    addr:40;
+               u64 addr:40;
+#else
+               u64 addr:40;
+               u64 code:7;
+               u64 tstamp:1;
+               u64 len:14;
+               u64 reserved_62_63:2;
+#endif
        } s;
 };
 
-- 
1.7.11.7


<Prev in Thread] Current Thread [Next in Thread>