Subject: Re: net: fec: make driver endian-safe

From: Johannes Berg <[email-masked]>
Date: Sun, 24 Jan 2016 08:26:13 +0100

On Sat, 2016-01-23 at 23:09 +0100, Johannes Berg wrote:
> 
> +/* buffer endianness appears to be a mess ... ARM is usually LE but
> can be BE */
> +#if defined(CONFIG_ARM) && defined(CONFIG_CPU_BIG_ENDIAN)

Just realized that this is, of course, completely wrong. If the ARM CPU
is little endian, the device is of course *still* little endian, it
doesn't magically change itself with the CONFIG_CPU_BIG_ENDIAN
setting... :)

Ergo, the #if part should be taken, rather than the #else part, to
still define the descriptors as __le and just have no byteswapping
done.

Also, as Arnd had pointed out last night but I wasn't coherent enough
to fully understand, it's exceedingly likely that

>  #if defined(CONFIG_ARCH_MXC) || defined(CONFIG_SOC_IMX28)

this needs to be changed and that the device is simply "generated" as
little-endian for ARM SoCs. He also pointed out that there could be
multiple CONFIG_SOC or CONFIG_ARCH definitions (if I understood
correctly), so this would be wrong anyway.

It's tempting to combine both ifdefs and change them to just CONFIG_ARM
but I have no way of verifying that on anything other than i.MX6 (on
the hummingboard), nor do I even know which SoCs ship with this block.

johannes