Commit 3fa5f11d authored by Stefano Brivio's avatar Stefano Brivio Committed by David S. Miller

geneve: Get rid of is_all_zero(), streamline is_tnl_info_zero()

No need to re-invent memchr_inv() with !is_all_zero(). While at
it, replace conditional and return clauses with a single return
clause in is_tnl_info_zero().
Signed-off-by: default avatarStefano Brivio <sbrivio@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c44768e0
...@@ -1140,24 +1140,11 @@ static struct geneve_dev *geneve_find_dev(struct geneve_net *gn, ...@@ -1140,24 +1140,11 @@ static struct geneve_dev *geneve_find_dev(struct geneve_net *gn,
return t; return t;
} }
static bool is_all_zero(const u8 *fp, size_t size)
{
int i;
for (i = 0; i < size; i++)
if (fp[i])
return false;
return true;
}
static bool is_tnl_info_zero(const struct ip_tunnel_info *info) static bool is_tnl_info_zero(const struct ip_tunnel_info *info)
{ {
if (info->key.tun_id || info->key.tun_flags || info->key.tos || return !(info->key.tun_id || info->key.tun_flags || info->key.tos ||
info->key.ttl || info->key.label || info->key.tp_src || info->key.ttl || info->key.label || info->key.tp_src ||
!is_all_zero((const u8 *)&info->key.u, sizeof(info->key.u))) memchr_inv(&info->key.u, 0, sizeof(info->key.u)));
return false;
else
return true;
} }
static bool geneve_dst_addr_equal(struct ip_tunnel_info *a, static bool geneve_dst_addr_equal(struct ip_tunnel_info *a,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment