From: Jiri Benc <jbenc@redhat.com>
To: Amir Vadai <amir@vadai.me>
Cc: "David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org,
John Fastabend <john.r.fastabend@intel.com>,
Jiri Pirko <jiri@mellanox.com>,
Cong Wang <xiyou.wangcong@gmail.com>,
Jamal Hadi Salim <jhs@mojatatu.com>,
Or Gerlitz <ogerlitz@mellanox.com>,
Hadar Har-Zion <hadarh@mellanox.com>
Subject: Re: [PATCH net-next 1/3] net/ip_tunnels: Introduce tunnel_id_to_key32() and key32_to_tunnel_id()
Date: Mon, 22 Aug 2016 19:00:27 +0200 [thread overview]
Message-ID: <20160822190027.6b4e6028@griffin> (raw)
In-Reply-To: <20160822143834.32422-2-amir@vadai.me>
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
next prev parent reply other threads:[~2016-08-22 17:00 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-22 14:38 [PATCH net-next 0/3] net/sched: iptunnel encap/decap/classify using TC Amir Vadai
2016-08-22 14:38 ` [PATCH net-next 1/3] net/ip_tunnels: Introduce tunnel_id_to_key32() and key32_to_tunnel_id() Amir Vadai
2016-08-22 17:00 ` Jiri Benc [this message]
2016-08-23 6:39 ` Amir Vadai
2016-08-22 14:38 ` [PATCH net-next 2/3] net/sched: cls_flower: Classify packet in ip tunnels Amir Vadai
2016-08-22 17:05 ` Jiri Benc
2016-08-22 17:17 ` Alexei Starovoitov
2016-08-22 14:38 ` [PATCH net-next 3/3] net/sched: Introduce act_iptunnel Amir Vadai
2016-08-22 17:07 ` Jiri Benc
2016-08-22 17:57 ` Shmulik Ladkani
2016-08-23 8:42 ` Amir Vadai
2016-08-22 18:15 ` Or Gerlitz
2016-08-22 18:51 ` Jiri Benc
2016-08-23 15:28 ` Amir Vadai
2016-08-23 15:33 ` Jiri Benc
2016-08-23 16:05 ` Amir Vadai
2016-08-23 16:15 ` Jiri Benc
2016-08-23 12:37 ` Jamal Hadi Salim
2016-08-23 16:21 ` Amir Vadai
2016-08-23 18:59 ` Shmulik Ladkani
2016-08-22 22:23 ` [PATCH net-next 0/3] net/sched: iptunnel encap/decap/classify using TC Tom Herbert
2016-08-23 9:05 ` Amir Vadai
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=20160822190027.6b4e6028@griffin \
--to=jbenc@redhat.com \
--cc=amir@vadai.me \
--cc=davem@davemloft.net \
--cc=hadarh@mellanox.com \
--cc=jhs@mojatatu.com \
--cc=jiri@mellanox.com \
--cc=john.r.fastabend@intel.com \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=xiyou.wangcong@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.