aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorVeaceslav Falico <vfalico@redhat.com>2013-09-27 10:11:57 -0400
committerDavid S. Miller <davem@davemloft.net>2013-09-28 18:27:59 -0400
commit3c4c88a138f0857b9e77266e09ad147d17629401 (patch)
treeb7cb957d6edee3b07bb7d60270bc9449a17a55dd /drivers/net
parent746844931ed400eef32edaa069b996eb622bc39a (diff)
bonding: remove __get_next_port()
Currently this function is only used in constructs like for (port = __get_first_port(bond); port; port = __get_next_port(port)) which is basicly the same as bond_for_each_slave(bond, slave, iter) { port = &(SLAVE_AD_INFO(slave).port); but a more time consuming. Remove the function and convert the users to bond_for_each_slave(). CC: Jay Vosburgh <fubar@us.ibm.com> CC: Andy Gospodarek <andy@greyhouse.net> Signed-off-by: Veaceslav Falico <vfalico@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_3ad.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 2715ea87d64c..c1535f8762d1 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -149,28 +149,6 @@ static inline struct port *__get_first_port(struct bonding *bond)
149} 149}
150 150
151/** 151/**
152 * __get_next_port - get the next port in the bond
153 * @port: the port we're looking at
154 *
155 * Return the port of the slave that is next in line of @port's slave in the
156 * bond, or %NULL if it can't be found.
157 */
158static inline struct port *__get_next_port(struct port *port)
159{
160 struct bonding *bond = __get_bond_by_port(port);
161 struct slave *slave = port->slave, *slave_next;
162
163 // If there's no bond for this port, or this is the last slave
164 if (bond == NULL)
165 return NULL;
166 slave_next = bond_next_slave(bond, slave);
167 if (!slave_next || bond_is_first_slave(bond, slave_next))
168 return NULL;
169
170 return &(SLAVE_AD_INFO(slave_next).port);
171}
172
173/**
174 * __get_first_agg - get the first aggregator in the bond 152 * __get_first_agg - get the first aggregator in the bond
175 * @bond: the bond we're looking at 153 * @bond: the bond we're looking at
176 * 154 *
@@ -2113,8 +2091,10 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
2113{ 2091{
2114 struct bonding *bond = container_of(work, struct bonding, 2092 struct bonding *bond = container_of(work, struct bonding,
2115 ad_work.work); 2093 ad_work.work);
2116 struct port *port;
2117 struct aggregator *aggregator; 2094 struct aggregator *aggregator;
2095 struct list_head *iter;
2096 struct slave *slave;
2097 struct port *port;
2118 2098
2119 read_lock(&bond->lock); 2099 read_lock(&bond->lock);
2120 2100
@@ -2139,7 +2119,8 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
2139 } 2119 }
2140 2120
2141 // for each port run the state machines 2121 // for each port run the state machines
2142 for (port = __get_first_port(bond); port; port = __get_next_port(port)) { 2122 bond_for_each_slave(bond, slave, iter) {
2123 port = &(SLAVE_AD_INFO(slave).port);
2143 if (!port->slave) { 2124 if (!port->slave) {
2144 pr_warning("%s: Warning: Found an uninitialized port\n", 2125 pr_warning("%s: Warning: Found an uninitialized port\n",
2145 bond->dev->name); 2126 bond->dev->name);
@@ -2384,9 +2365,12 @@ int __bond_3ad_get_active_agg_info(struct bonding *bond,
2384 struct ad_info *ad_info) 2365 struct ad_info *ad_info)
2385{ 2366{
2386 struct aggregator *aggregator = NULL; 2367 struct aggregator *aggregator = NULL;
2368 struct list_head *iter;
2369 struct slave *slave;
2387 struct port *port; 2370 struct port *port;
2388 2371
2389 for (port = __get_first_port(bond); port; port = __get_next_port(port)) { 2372 bond_for_each_slave(bond, slave, iter) {
2373 port = &(SLAVE_AD_INFO(slave).port);
2390 if (port->aggregator && port->aggregator->is_active) { 2374 if (port->aggregator && port->aggregator->is_active) {
2391 aggregator = port->aggregator; 2375 aggregator = port->aggregator;
2392 break; 2376 break;