[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1379378812-18346-23-git-send-email-vfalico@redhat.com>
Date: Tue, 17 Sep 2013 02:46:47 +0200
From: Veaceslav Falico <vfalico@...hat.com>
To: netdev@...r.kernel.org
Cc: jiri@...nulli.us, Veaceslav Falico <vfalico@...hat.com>,
Jay Vosburgh <fubar@...ibm.com>,
Andy Gospodarek <andy@...yhouse.net>
Subject: [PATCH v3 net-next 22/27] bonding: use neighbours for bond_next_slave()
If it's the last slave - return the first slave, otherwise - return the
next slave via netdev_lower_dev_get_next_private().
CC: Jay Vosburgh <fubar@...ibm.com>
CC: Andy Gospodarek <andy@...yhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@...hat.com>
---
Notes:
v2 -> v3:
No change.
v1 -> v2:
No changes.
RFC -> v1:
Change to standard logic - if it's the last slave - return the first one,
otherwise - return the next via netdev_lower_dev_get_next_private().
Also, bond_prev_slave() was dropped - so we don't need it.
drivers/net/bonding/bonding.h | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 03daadd..9329509 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -76,8 +76,6 @@
#define bond_has_slaves(bond) !list_empty(bond_slave_list(bond))
-#define bond_to_slave(ptr) list_entry(ptr, struct slave, list)
-
/* IMPORTANT: bond_first/last_slave can return NULL in case of an empty list */
#define bond_first_slave(bond) \
(bond_has_slaves(bond) ? \
@@ -93,8 +91,9 @@
/* Since bond_first/last_slave can return NULL, these can return NULL too */
#define bond_next_slave(bond, pos) \
- (bond_is_last_slave(bond, pos) ? bond_first_slave(bond) : \
- bond_to_slave((pos)->list.next))
+ (bond_is_last_slave(bond, pos) ? \
+ bond_first_slave(bond) : \
+ netdev_lower_dev_get_next_private((bond)->dev, pos))
/**
* bond_for_each_slave - iterate over all slaves
--
1.8.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists