[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <CE8C6D20-5567-42E3-B999-FBC9A576C499@scaleway.com>
Date: Thu, 22 Nov 2018 19:10:16 +0100
From: Alexis Bauvin <abauvin@...leway.com>
To: David Ahern <dsa@...ulusnetworks.com>, roopa@...ulusnetworks.com
Cc: netdev@...r.kernel.org, akherbouche@...leway.com,
Alexis Bauvin <abauvin@...leway.com>
Subject: Re: [RFC v4 4/5] netdev: add netdev_is_upper_master
Le 22 nov. 2018 à 18:14, David Ahern <dsa@...ulusnetworks.com> a écrit :
> On 11/21/18 6:07 PM, Alexis Bauvin wrote:
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index 93243479085f..12459036d0da 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -7225,6 +7225,23 @@ void netdev_lower_state_changed(struct net_device *lower_dev,
>> }
>> EXPORT_SYMBOL(netdev_lower_state_changed);
>>
>> +/**
>> + * netdev_is_upper_master - Test if a device is a master, direct or indirect,
>> + * of another one.
>> + * @dev: device to start looking from
>> + * @master: device to test if master of dev
>> + */
>> +bool netdev_is_upper_master(struct net_device *dev, struct net_device *master)
>> +{
>> + if (!dev)
>> + return false;
>> +
>> + if (dev->ifindex == master->ifindex)
>
> dev == master should work as well without the dereference.
Ack, will add to next version.
>> + return true;
>> + return netdev_is_upper_master(netdev_master_upper_dev_get(dev), master);
>> +}
>> +EXPORT_SYMBOL(netdev_is_upper_master);
>> +
>> static void dev_change_rx_flags(struct net_device *dev, int flags)
>> {
>> const struct net_device_ops *ops = dev->netdev_ops;
>>
Powered by blists - more mailing lists