From: Stefano Brivio <sbrivio@redhat.com>
To: "David S . Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Cc: pravin shelar <pshelar@ovn.org>
Subject: Re: [PATCH net-next] geneve: Get rid of is_all_zero(), streamline is_tnl_info_zero()
Date: Thu, 19 Oct 2017 17:31:59 +0200 [thread overview]
Message-ID: <20171019173159.2ba714d7@elisabeth> (raw)
In-Reply-To: <94e6eb12a3260e8f569dd072686067ff52c89199.1508411792.git.sbrivio@redhat.com>
On Thu, 19 Oct 2017 13:31:39 +0200
Stefano Brivio <sbrivio@redhat.com> wrote:
> 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>
> ---
> drivers/net/geneve.c | 19 +++----------------
> 1 file changed, 3 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
> index f6404074b7b0..869726660b83 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)));
NAK, I messed up the check entirely, I'll send a v2, sorry for the
noise.
--
Stefano
prev parent reply other threads:[~2017-10-19 15:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-19 11:31 [PATCH net-next] geneve: Get rid of is_all_zero(), streamline is_tnl_info_zero() Stefano Brivio
2017-10-19 15:31 ` Stefano Brivio [this message]
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=20171019173159.2ba714d7@elisabeth \
--to=sbrivio@redhat.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=pshelar@ovn.org \
/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.