Skip to content

Commit 3fa5f11

Browse files
sbrivio-rhdavem330
authored andcommitted
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>
1 parent c44768e commit 3fa5f11

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

drivers/net/geneve.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,24 +1140,11 @@ static struct geneve_dev *geneve_find_dev(struct geneve_net *gn,
11401140
return t;
11411141
}
11421142

1143-
static bool is_all_zero(const u8 *fp, size_t size)
1144-
{
1145-
int i;
1146-
1147-
for (i = 0; i < size; i++)
1148-
if (fp[i])
1149-
return false;
1150-
return true;
1151-
}
1152-
11531143
static bool is_tnl_info_zero(const struct ip_tunnel_info *info)
11541144
{
1155-
if (info->key.tun_id || info->key.tun_flags || info->key.tos ||
1156-
info->key.ttl || info->key.label || info->key.tp_src ||
1157-
!is_all_zero((const u8 *)&info->key.u, sizeof(info->key.u)))
1158-
return false;
1159-
else
1160-
return true;
1145+
return !(info->key.tun_id || info->key.tun_flags || info->key.tos ||
1146+
info->key.ttl || info->key.label || info->key.tp_src ||
1147+
memchr_inv(&info->key.u, 0, sizeof(info->key.u)));
11611148
}
11621149

11631150
static bool geneve_dst_addr_equal(struct ip_tunnel_info *a,

0 commit comments

Comments
 (0)