From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 1 Oct 2020 14:25:38 -0700 From: Stephen Hemminger Subject: Re: [PATCH net 00/12] net: iflink and link-netnsid fixes Message-ID: <20201001142538.03f28397@hermes.local> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sabrina Dubroca Cc: netdev@vger.kernel.org, Nicolas Dichtel , Marek Lindner , Simon Wunderlich , Antonio Quartulli , Sven Eckelmann , b.a.t.m.a.n@lists.open-mesh.org, Roopa Prabhu , Nikolay Aleksandrov On Thu, 1 Oct 2020 09:59:24 +0200 Sabrina Dubroca wrote: > In a lot of places, we use this kind of comparison to detect if a > device has a lower link: > > dev->ifindex != dev_get_iflink(dev) Since this is a common operation, it would be good to add a new helper function in netdevice.h In your patch set, you are copying the same code snippet which seems to indicate that it should be a helper. Something like: static inline bool netdev_has_link(const struct net_device *dev) { const struct net_device_ops *ops = dev->netdev_ops; return ops && ops->ndo_get_iflink; }