[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 10 Oct 2011 09:20:38 +0100
From: "David Laight" <David.Laight@...LAB.COM>
To: "Benjamin Herrenschmidt" <benh@...nel.crashing.org>,
"Eli Cohen" <eli@....mellanox.co.il>
Cc: <netdev@...r.kernel.org>, "Eli Cohen" <eli@...lanox.co.il>,
<linuxppc-dev@...ts.ozlabs.org>,
"Thadeu Lima de Souza Cascardo" <cascardo@...ux.vnet.ibm.com>,
"Yevgeny Petrilin" <yevgenyp@...lanox.co.il>
Subject: RE: [PATCH] mlx4_en: fix transmit of packages when blue frame is enabled
> Then, this statement:
>
> *(u32 *) (&tx_desc->ctrl.vlan_tag) |= ring->doorbell_qpn;
...
> instead do ... :
> *(u32 *) (&tx_desc->ctrl.vlan_tag) |=
cpu_to_be32(ring->doorbell_qpn);
>
> (Also get rid of that cast and define vlan_tag as a __be32 to start
> with).
Agreed, casts that change the type of memory - *(foo *)&xxx - are
generally bad news unless you are casting a generic 'buffer' to
a specific structure.
I've seen far to much code that ends up being depending on the
endianness and system word size.
For the above I'd actually suggest making 'doorbell_qpn' have the
correct endianness in order to avoid the (potential) swap every
time it is set.
You also need to treble-check the required endianness for the
'vlan_tag' in the tx descriptor. What would be needed is the
MAC PCI slave were on an x86 (LE) system.
David
--
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