Subject: Re: [PATCH net-next v1 5/9] bonding: convert bond_has_this_ip() to use upper devices

From: Veaceslav Falico <[email-masked]>
Date: Wed, 28 Aug 2013 18:32:46 +0200

On Wed, Aug 28, 2013 at 10:56:32AM -0400, Vlad Yasevich wrote:
...snip...
>I've been playing with approach 2 for some work I am doing for
>macvtap-over-bond, but I like you idea for 3 better.
>
>It would make things simpler in the long run.

I've just sent the third version of the 3rd approach, which implements
lower/upper device lists for every device that are guaranteed, under RCU,
tu have all the upper/lower devices linked to the device. It also permits
to distinguish the 'neighbour' devices (i.e. linked on the first level,
i.e. direct-linked) from the 'distant' ones, which are not directly linked
but rather inherited.

It also implements the first function (and the only one that I've needed
to get rid of vlan lists in bonding) - netdev_for_each_upper_dev_rcu(),
which can be used as a loop:

struct net_device *upper;
struct list_head *iter;

rcu_read_lock();
netdev_for_each_upper_dev_rcu(dev, upper, iter) {
	... do whatever you want with the upper dev ...
}
rcu_read_unlock();

In case you'll need, you can easily implement the same way
netdev_for_each_lower_dev_rcu().

Hope that helps.

>-vlad