summaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bonding.h
diff options
context:
space:
mode:
authordingtianhong2013-12-13 03:19:55 +0100
committerDavid S. Miller2013-12-14 07:58:02 +0100
commite001bfad913bf119fb67c1e8dd2d4ec1f5d392fa (patch)
treefe08e42121a1b5e9bf173af18c04e78c884cc5bf /drivers/net/bonding/bonding.h
parentbonding: rebuild the lock use for bond_loadbalance_arp_mon() (diff)
downloadkernel-qcow2-linux-e001bfad913bf119fb67c1e8dd2d4ec1f5d392fa.tar.gz
kernel-qcow2-linux-e001bfad913bf119fb67c1e8dd2d4ec1f5d392fa.tar.xz
kernel-qcow2-linux-e001bfad913bf119fb67c1e8dd2d4ec1f5d392fa.zip
bonding: create bond_first_slave_rcu()
The bond_first_slave_rcu() will be used to instead of bond_first_slave() in rcu_read_lock(). According to the Jay Vosburgh's suggestion, the struct netdev_adjacent should hide from users who wanted to use it directly. so I package a new function to get the first slave of the bond. Suggested-by: Nikolay Aleksandrov <nikolay@redhat.com> Suggested-by: Jay Vosburgh <fubar@us.ibm.com> Suggested-by: Veaceslav Falico <vfalico@redhat.com> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bonding.h')
-rw-r--r--drivers/net/bonding/bonding.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 8283cbdec50a..8f0d6d0c383b 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -101,6 +101,10 @@
netdev_adjacent_get_private(bond_slave_list(bond)->prev) : \
NULL)
+/* Caller must have rcu_read_lock */
+#define bond_first_slave_rcu(bond) \
+ netdev_lower_get_first_private_rcu(bond->dev)
+
#define bond_is_first_slave(bond, pos) (pos == bond_first_slave(bond))
#define bond_is_last_slave(bond, pos) (pos == bond_last_slave(bond))