public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber•org>
To: Sowmini Varadhan <sowmini.varadhan@oracle•com>
Cc: netdev@vger•kernel.org
Subject: Re: [PATCH RFC net-next] arp: Really delete an arp entry on "arp -d"
Date: Tue, 30 May 2017 16:20:20 -0700	[thread overview]
Message-ID: <20170530162020.137aef02@xeon-e3> (raw)
In-Reply-To: <1496116096-77316-1-git-send-email-sowmini.varadhan@oracle.com>

On Mon, 29 May 2017 20:48:16 -0700
Sowmini Varadhan <sowmini.varadhan@oracle•com> wrote:

> +	np = &nht->hash_buckets[hash_val];
> +	while ((n = rcu_dereference_protected(*np,
> +				lockdep_is_held(&tbl->lock))) != NULL) {
> +		write_lock(&n->lock);
> +		if (n == ndel) {
> +			bool retval = false;
> +
> +			if  (atomic_read(&n->refcnt) == 1) {
> +				rcu_assign_pointer(*np,
> +					rcu_dereference_protected(n->next,
> +					lockdep_is_held(&tbl->lock)));
> +				n->dead = 1;
> +				retval = true;
> +			}
> +			write_unlock(&n->lock);
> +			if (retval)
> +				neigh_cleanup_and_release(n);
> +			write_unlock_bh(&tbl->lock);
> +			return retval;
> +		}
> +		write_unlock(&n->lock);
> +		np = &n->next;
> +	}
> +

Please don't copy/paste chunks of code. Instead refactor and make this
into a helper function. 

  reply	other threads:[~2017-05-30 23:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30  3:48 [PATCH RFC net-next] arp: Really delete an arp entry on "arp -d" Sowmini Varadhan
2017-05-30 23:20 ` Stephen Hemminger [this message]
2017-05-30 23:32   ` Sowmini Varadhan
2017-05-31  0:42     ` David Ahern
2017-05-31 15:22       ` Sowmini Varadhan

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=20170530162020.137aef02@xeon-e3 \
    --to=stephen@networkplumber$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=sowmini.varadhan@oracle$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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