public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Ursula Braun <ubraun@linux.vnet.ibm.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	"schwidefsky@de.ibm.com" <schwidefsky@de.ibm.com>,
	"heiko.carstens@de.ibm.com" <heiko.carstens@de.ibm.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>,
	"ursula.braun@de.ibm.com" <ursula.braun@de.ibm.com>,
	Vaishali Thakkar <vthakkar1994@gmail.com>
Subject: RE: [PATCH net-next 2/3] qeth: Convert use of __constant_htons to htons
Date: Thu, 20 Aug 2015 13:43:56 +0200	[thread overview]
Message-ID: <1440071036.685.7.camel@BR9GV9YG.de.ibm.com> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CB804CD@AcuExch.aculab.com>

On Thu, 2015-08-20 at 10:46 +0000, David Laight wrote:
> From: Ursula Braun
> > Sent: 19 August 2015 09:21
> > In little endian cases, the macro htons unfolds to __swab16 which
> > provides special case for constants. In big endian cases,
> > __constant_htons and htons expand directly to the same expression.
> > So, replace __constant_htons with htons with the goal of getting
> > rid of the definition of __constant_htons completely.
> ...
> > diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
> > index 70eb2f6..ecfe622 100644
> > --- a/drivers/s390/net/qeth_l3_main.c
> > +++ b/drivers/s390/net/qeth_l3_main.c
> > @@ -1887,13 +1887,13 @@ static inline int qeth_l3_rebuild_skb(struct qeth_card *card,
> >  		case QETH_CAST_MULTICAST:
> >  			switch (prot) {
> >  #ifdef CONFIG_QETH_IPV6
> > -			case __constant_htons(ETH_P_IPV6):
> > +			case htons(ETH_P_IPV6):
> 
> I didn't think htons() was 'constant enough' to be used as a case label.
> 
> Using byteswapped constants in a case statement can change it from being
> implemented as a jump table to a branch tree.
> This might be more expensive than byteswapping the value (even on systems
> that don't have cheap byteswap instructions).
> 
> 	David
> 
For big endian systems both __constant_htons(x) and htons(x) are
resolved to ((__force __be16)(__u16)(x)). Thus I do not see a reason to
reject the patch proposal from Vaishali Thakkar.

Ursula

  reply	other threads:[~2015-08-20 11:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-19  8:20 [PATCH net-next 0/3] s390: qeth patches for net-next Ursula Braun
2015-08-19  8:20 ` [PATCH net-next 1/3] qeth: remove extraneous length from %pM format Ursula Braun
2015-08-19  8:20 ` [PATCH net-next 2/3] qeth: Convert use of __constant_htons to htons Ursula Braun
2015-08-20 10:46   ` David Laight
2015-08-20 11:43     ` Ursula Braun [this message]
2015-08-20 11:51       ` David Laight
2015-08-20 13:53         ` Ursula Braun
2015-08-20 17:58           ` David Miller
2015-08-20 18:58             ` Vaishali Thakkar
2015-08-20 20:56               ` David Miller
2015-08-19  8:20 ` [PATCH net-next 3/3] qeth: no write permission for readonly sysattr Ursula Braun

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=1440071036.685.7.camel@BR9GV9YG.de.ibm.com \
    --to=ubraun@linux.vnet.ibm.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=davem@davemloft.net \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=ursula.braun@de.ibm.com \
    --cc=vthakkar1994@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox