]> git.baikalelectronics.ru Git - kernel.git/commit
net: ethernet: sun4i-emac: Read rxhdr in CPU byte-order
authorMichael Weiser <michael.weiser@gmx.de>
Mon, 14 Nov 2016 17:58:07 +0000 (18:58 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Nov 2016 03:05:54 +0000 (22:05 -0500)
commitacf3d54f92429a76d6276ba1f38138b3108fd5e9
tree172f5312370f95699df4df418d5aeedc70599465
parent1acb1fb29737447d9f04c5abf80e33d730399efc
net: ethernet: sun4i-emac: Read rxhdr in CPU byte-order

The EMAC EMAC_RX_IO_DATA_REG data register is dual-purpose: On one hand
it is used to move actual packet data off the wire. This will be in
wire-format and accepted as such by higher layers such as IP. Therefore
it is correctly read as-is (i.e. raw) using readsl.

On the other hand it provides metadata about incoming transfers to the
driver such as length and checksum validation status. This data is
little-endian, always and it is interpreted by the driver. Therefore it
needs to be swapped to CPU endianness to make sense to the driver. This
is already done for the "receive header" but not rxhdr.

Read rxhdr using readl in order for sun4i-emac to work correctly when
running a big-endian kernel.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/allwinner/sun4i-emac.c