[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160822190027.6b4e6028@griffin>
Date: Mon, 22 Aug 2016 19:00:27 +0200
From: Jiri Benc <jbenc@...hat.com>
To: Amir Vadai <amir@...ai.me>
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()
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?
> +#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.
> +{
> +#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