All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: David Miller <davem@davemloft.net>
Cc: f.fainelli@gmail.com, netdev@vger.kernel.org, opendmb@gmail.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 1/2] net: bcmgenet: Fix sparse warnings in bcmgenet_put_tx_csum()
Date: Tue, 3 Apr 2018 17:45:45 +0100	[thread overview]
Message-ID: <20180403164545.GK30522@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20180403.123305.1783530733365447500.davem@davemloft.net>

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.

  reply	other threads:[~2018-04-03 16:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-02 22:58 [PATCH net 0/2] net: Broadcom drivers sparse fixes Florian Fainelli
2018-04-02 22:58 ` [PATCH net 1/2] net: bcmgenet: Fix sparse warnings in bcmgenet_put_tx_csum() Florian Fainelli
2018-04-03 16:29   ` Al Viro
2018-04-03 16:33     ` David Miller
2018-04-03 16:45       ` Al Viro [this message]
2018-04-03 20:40         ` Florian Fainelli
2018-04-06 20:05   ` Sasha Levin
2018-04-06 20:05     ` Sasha Levin
2018-04-02 22:58 ` [PATCH net 2/2] net: systemport: Fix sparse warnings in bcm_sysport_insert_tsb() Florian Fainelli
2018-04-03 16:23   ` Al Viro
2018-04-06 20:05   ` Sasha Levin
2018-04-06 20:05     ` Sasha Levin
2018-04-04 15:07 ` [PATCH net 0/2] net: Broadcom drivers sparse fixes David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180403164545.GK30522@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=opendmb@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.