From: Joe Perches <joe@perches.com>
To: Yajun Deng <yajun.deng@linux.dev>, davem@davemloft.net, kuba@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] neighbor: Remove redundant if statement
Date: Mon, 22 Nov 2021 01:16:53 -0800 [thread overview]
Message-ID: <8e739443edb76961dfe949f82f52db9be9210adc.camel@perches.com> (raw)
In-Reply-To: <20211122084909.18093-1-yajun.deng@linux.dev>
On Mon, 2021-11-22 at 16:49 +0800, Yajun Deng wrote:
> The if statement already exists in the __neigh_event_send() function,
> remove redundant if statement.
[]
> diff --git a/include/net/neighbour.h b/include/net/neighbour.h
[]
> @@ -452,9 +452,7 @@ static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
>
> if (READ_ONCE(neigh->used) != now)
> WRITE_ONCE(neigh->used, now);
> - if (!(neigh->nud_state&(NUD_CONNECTED|NUD_DELAY|NUD_PROBE)))
> - return __neigh_event_send(neigh, skb);
> - return 0;
> + return __neigh_event_send(neigh, skb);
> }
Perhaps this is an optimization to avoid the lock/unlock in __neigh_event_send?
If so a comment could be useful.
And also perhaps this code would be clearer with the test reversed:
if (neigh->nud_state & (NUD_CONNECTED | NUD_DELAY | NUD_PROBE))
return 0;
return __neigh_event_send(neigh, skb);
prev parent reply other threads:[~2021-11-22 9:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-22 8:49 Yajun Deng
2021-11-22 9:16 ` Joe Perches [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=8e739443edb76961dfe949f82f52db9be9210adc.camel@perches.com \
--to=joe@perches.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yajun.deng@linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®