Thread (21 messages) flat view 21 messages, 6 authors, 2022-05-14

Re: [PATCH net 00/12] net: iflink and link-netnsid fixes

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2020-10-01 21:25:48
Also in: batman

On Thu,  1 Oct 2020 09:59:24 +0200
Sabrina Dubroca [off-list ref] 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;
}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help