[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160823063949.GA9128@office.localdomain>
Date: Tue, 23 Aug 2016 09:39:49 +0300
From: Amir Vadai <amir@...ai.me>
To: Jiri Benc <jbenc@...hat.com>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
John Fastabend <john.r.fastabend@...el.com>,
Jiri Pirko <jiri@...lanox.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Jamal Hadi Salim <jhs@...atatu.com>,
Or Gerlitz <ogerlitz@...lanox.com>,
Hadar Har-Zion <hadarh@...lanox.com>
Subject: Re: [PATCH net-next 1/3] net/ip_tunnels: Introduce
tunnel_id_to_key32() and key32_to_tunnel_id()
On Mon, Aug 22, 2016 at 07:00:27PM +0200, Jiri Benc wrote:
> While cleaning this up, you may as well take the best of both
> implementations.
>
> On Mon, 22 Aug 2016 17:38:32 +0300, Amir Vadai wrote:
> > +static inline __be64 key32_to_tunnel_id(__be32 key)
> > +{
> > +#ifdef __BIG_ENDIAN
> > + return (__force __be64)((__force u32)key);
>
> The inner cast seems to be superfluous?
seems so. will check.
>
> > +#else
> > + return (__force __be64)((__force u64)key << 32);
> > +#endif
> > +}
> > +
> > +/* Returns the least-significant 32 bits of a __be64. */
> > +static inline __be32 tunnel_id_to_key32(__be64 x)
>
> Please use a more descriptive name than "x". "tunnel_id" or "tun_id"
> seems to be more appropriate.
ack
>
> > +{
> > +#ifdef __BIG_ENDIAN
> > + return (__force __be32)x;
> > +#else
> > + return (__force __be32)((__force u64)x >> 32);
> > +#endif
> > +}
>
> Looks good otherwise.
>
> Thanks,
>
> Jiri
Powered by blists - more mailing lists