On Thu,  1 Oct 2020 09:59:24 +0200
Sabrina Dubroca <s...@queasysnail.net> 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;
}

Reply via email to