diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2017-10-20 13:31:36 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-22 02:42:39 +0100 |
commit | 3fa5f11de1ab98a6c54693b78880167a2693cee1 (patch) | |
tree | 4dcf64be7d2892ee037a6208647275b2a642d5b7 /drivers | |
parent | c44768e058827064704452f88b543f802f955cae (diff) |
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: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/geneve.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index f6404074b7b0..01f7355ad277 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -1140,24 +1140,11 @@ static struct geneve_dev *geneve_find_dev(struct geneve_net *gn, 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) { - if (info->key.tun_id || info->key.tun_flags || info->key.tos || - info->key.ttl || info->key.label || info->key.tp_src || - !is_all_zero((const u8 *)&info->key.u, sizeof(info->key.u))) - return false; - else - return true; + return !(info->key.tun_id || info->key.tun_flags || info->key.tos || + info->key.ttl || info->key.label || info->key.tp_src || + memchr_inv(&info->key.u, 0, sizeof(info->key.u))); } static bool geneve_dst_addr_equal(struct ip_tunnel_info *a, |