[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150816003926.GA31357@breakpoint.cc>
Date: Sun, 16 Aug 2015 02:39:26 +0200
From: Florian Westphal <fw@...len.de>
To: David Ahern <dsa@...ulusnetworks.com>
Cc: netdev@...r.kernel.org, eric.dumazet@...il.com
Subject: Re: [PATCH] net: Updates to netif_index_is_vrf
David Ahern <dsa@...ulusnetworks.com> wrote:
> As Eric noted netif_index_is_vrf is not called with rcu_read_lock held,
> so use dev_get_by_index instead of dev_get_by_index_rcu.
>
> If VRF is not enabled or oif is 0 skip the device lookup.
>
> Signed-off-by: David Ahern <dsa@...ulusnetworks.com>
Why not
> static inline bool netif_index_is_vrf(struct net *net, int ifindex)
> {
> - struct net_device *dev = dev_get_by_index_rcu(net, ifindex);
> bool rc = false;
>
> - if (dev)
> - rc = netif_is_vrf(dev);
> +#if IS_ENABLED(CONFIG_NET_VRF)
> + struct net_device *dev;
> +
> + if (ifindex == 0)
> + return false;
rcu_read_lock();
dev = dev_get_by_index_rcu(net, ifindex);
if (dev)
rc = netif_is_vrf(dev);
rcu_read_unlock();
> +#endif
> return rc;
instead?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists