On Tue, 1 Oct 2019 at 16:11, Johannes Berg <johannes@xxxxxxxxxxxxxxxx> wrote: > > Hi, > Hi! > Sorry for the delay. > > > These functions are used as a callback function of > > netdev_walk_all_{upper/lower}_dev(). So these return types are needed. > > Ah yes, I missed that, sorry. > > > Without storing level storing, a walking graph routine is needed only > > once. The routine would work as a nesting depth validator. > > So that the detach routine doesn't need to walk the graph. > > Whereas, in this patch, both attach and detach routine need to > > walk graph. So, storing nesting variable way is slower than without > > storing nesting variable way because of the detach routine's updating > > upper and lower level routine. > > Right, that's what I thought. > > > But I'm sure that storing nesting variables is useful because other > > modules already using nesting level values. > > Please look at vlan_get_encap_level() and usecases. > > Indeed, I noticed that later. > > > If we don't provide nesting level variables, they should calculate > > every time when they need it and this way is easier way to get a > > nesting level. There are use-cases of lower_level variable > > in the 11th patch. > > Yes, makes sense, agree. One could argue that you only ever need the > "lower_level" stored, not the "upper_level", but I guess that doesn't > really make a difference. > > Placing these in a better position in the struct might make sense - a > cursory look suggested that they weren't filling any of the many holes > there, did you pay attention to that or was the placement more or less > random? > If I understand correctly, you said about the alignment of "lower_level" and "upper_level". I thought this place is a fine position for variables as regards the alignment and I didn't try to put each variable in different places. If I misunderstood your mention, please let me know. Thank you > johannes >