All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: James Prestwood <prestwoj@gmail.com>, netdev@vger.kernel.org
Subject: Re: [PATCH v5 1/2] net: arp: introduce arp_evict_nocarrier sysctl parameter
Date: Thu, 21 Oct 2021 08:08:05 -0600	[thread overview]
Message-ID: <549f780b-3afb-ca30-acfe-76522bbea36a@gmail.com> (raw)
In-Reply-To: <20211021003212.878786-2-prestwoj@gmail.com>

On 10/20/21 6:32 PM, James Prestwood wrote:
> diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
> index 922dd73e5740..4d3b8d1463b7 100644
> --- a/net/ipv4/arp.c
> +++ b/net/ipv4/arp.c
> @@ -1257,7 +1259,16 @@ static int arp_netdev_event(struct notifier_block *this, unsigned long event,
>  		change_info = ptr;
>  		if (change_info->flags_changed & IFF_NOARP)
>  			neigh_changeaddr(&arp_tbl, dev);
> -		if (!netif_carrier_ok(dev))
> +
> +		rcu_read_lock();
> +		in_dev = __in_dev_get_rcu(dev);
> +		if (!in_dev)
> +			evict_nocarrier = true;
> +		else
> +			evict_nocarrier = IN_DEV_ARP_EVICT_NOCARRIER(in_dev);
> +		rcu_read_unlock();

I believe the rtnl lock is held, so you can use __in_dev_get_rtnl and
avoid the rcu_read_{,un}lock.

> +
> +		if (evict_nocarrier && !netif_carrier_ok(dev))
>  			neigh_carrier_down(&arp_tbl, dev);
>  		break;
>  	default:


  reply	other threads:[~2021-10-21 14:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21  0:32 [PATCH v5 0/2] Make neighbor eviction controllable by userspace James Prestwood
2021-10-21  0:32 ` [PATCH v5 1/2] net: arp: introduce arp_evict_nocarrier sysctl parameter James Prestwood
2021-10-21 14:08   ` David Ahern [this message]
2021-10-21  0:32 ` [PATCH v5 2/2] net: ndisc: introduce ndisc_evict_nocarrier " James Prestwood
2021-10-21 14:15   ` David Ahern
2021-10-21  2:33 ` [PATCH v5 0/2] Make neighbor eviction controllable by userspace David Ahern
2021-10-21 21:59   ` James Prestwood
2021-10-21 22:09     ` David Ahern

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=549f780b-3afb-ca30-acfe-76522bbea36a@gmail.com \
    --to=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=prestwoj@gmail.com \
    /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.