• Michael Weiser's avatar
    net: ethernet: sun4i-emac: Read rxhdr in CPU byte-order · 934d0048
    Michael Weiser authored
    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: default avatarMichael Weiser <michael.weiser@gmx.de>
    Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
    Cc: netdev@vger.kernel.org
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    934d0048
sun4i-emac.c 24 KB