[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180403164545.GK30522@ZenIV.linux.org.uk>
Date: Tue, 3 Apr 2018 17:45:45 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: David Miller <davem@...emloft.net>
Cc: f.fainelli@...il.com, netdev@...r.kernel.org, opendmb@...il.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net 1/2] net: bcmgenet: Fix sparse warnings in
bcmgenet_put_tx_csum()
On Tue, Apr 03, 2018 at 12:33:05PM -0400, David Miller wrote:
> Yes Al, however the pattern choosen here is probably cheaper on little endian:
>
> __beXX val = x;
> switch (val) {
> case htons(ETH_P_FOO):
> ...
> }
>
> This way only the compiler byte swaps the constants at compile time,
> no code is actually generated to do it.
That's not obvious, actually - depends upon how sparse the switch ends
up being. You can easily lose more than a single byteswap insn on
worse cascase of comparisons.
Powered by blists - more mailing lists