[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6DD002DBD7@AcuExch.aculab.com>
Date: Thu, 29 Jun 2017 13:47:33 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Jakub Kicinski' <jakub.kicinski@...ronome.com>,
Yunsheng Lin <linyunsheng@...wei.com>
CC: Simon Horman <simon.horman@...ronome.com>,
David Miller <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"oss-drivers@...ronome.com" <oss-drivers@...ronome.com>,
"Pieter Jansen van Vuuren" <pieter.jansenvanvuuren@...ronome.com>
Subject: RE: [PATCH net-next v2 4/9] nfp: extend flower add flow offload
From: Jakub Kicinski
> Sent: 29 June 2017 07:48
> On Thu, 29 Jun 2017 14:18:07 +0800, Yunsheng Lin wrote:
> > > + if (mask_basic->n_proto) {
> > cpu_to_be16(mask_basic->n_proto)
Should be be16_to_cpu()
> > remove cpu_to_be16 in case.
>
> Thanks, but this is incorrect. Byte swapping constants is done at
> compilation time - therefore it's preferred.
Except that the 'cpu' values are likely to be dense so the compiler
is likely to generate a jump table for the switch statement instead
of sequence of conditionals.
OTOH the jump table is almost certainly a data cache miss, whereas
the conditionals might be predicted correctly.
The best code might come from an explicitly ordered sequence of
conditionals.
David
Powered by blists - more mailing lists