Subject: Re: [PATCH v2 1/4] net: Find the nesting level of a given device by type.

From: Vlad Yasevich <[email-masked]>
Date: Fri, 16 May 2014 14:34:21 -0400

On 05/16/2014 01:32 PM, Eric Dumazet wrote:
> On Fri, 2014-05-16 at 13:18 -0400, Vlad Yasevich wrote:
>> Multiple devices in the kernel can be stacked/nested and they
>> need to know their nesting level for the purposes of lockdep.
>> This patch provides a generic function that determines a nesting
>> level of a particular device by its type (ex: vlan, macvlan, etc).
>> We only care about nesting of the same type of devices.
>>
>> For example:
>>   eth0 <- vlan0.10 <- macvlan0 <- vlan1.20
>>
>> The nesting level of vlan1.20 would be 1, since there is another vlan
>> in the stack under it.
>>
>> Signed-off-by: Vlad Yasevich <[email-masked]>
>> ---
>>  include/linux/netdevice.h | 10 ++++++++++
>>  net/core/dev.c            | 48 +++++++++++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 58 insertions(+)
> 
> Nice, but if LOCKDEP is not used, do we really want to have
> dev_get_nest_level() being something else than a constant ?
> 
> 

Doesn't seem to hurt.  As it stands right now, vlan code will
keep calculating its own every time it needs to take a lock
and it will be other then 1 when you have a stack of them.

-vlad