* [PATCH 3/10] [bonding 2.6] fix assign_current_slave
@ 2003-09-11 14:38 Amir Noam
0 siblings, 0 replies; only message in thread
From: Amir Noam @ 2003-09-11 14:38 UTC (permalink / raw)
To: bonding-devel, netdev
diff -Nuarp a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
--- a/drivers/net/bonding/bond_main.c Thu Sep 11 16:48:17 2003
+++ b/drivers/net/bonding/bond_main.c Thu Sep 11 16:48:18 2003
@@ -590,19 +590,6 @@ static void change_active_interface(stru
static void reselect_active_interface(struct bonding *bond);
static struct slave *find_best_interface(struct bonding *bond);
-/* Caller must hold bond->ptrlock for write */
-static inline struct slave*
-bond_assign_current_slave(struct bonding *bond,struct slave *newslave)
-{
- if ((bond_mode == BOND_MODE_TLB) ||
- (bond_mode == BOND_MODE_ALB)) {
- bond_alb_assign_current_slave(bond, newslave);
- } else {
- bond->current_slave = newslave;
- }
-
- return bond->current_slave;
-}
/* #define BONDING_DEBUG 1 */
@@ -1640,8 +1627,13 @@ static int bond_enslave(struct net_devic
#endif
/* always active in trunk mode */
new_slave->state = BOND_STATE_ACTIVE;
+
+ /* In trunking mode there is little meaning to current_slave
+ * anyway (it holds no special properties of the bond device),
+ * so we can change it without calling change_active_interface()
+ */
if (bond->current_slave == NULL)
- bond_assign_current_slave(bond, new_slave);
+ bond->current_slave = new_slave;
}
write_unlock_bh(&bond->lock);
@@ -1894,7 +1886,12 @@ static void change_active_interface(stru
bond_mc_update(bond, new, old);
}
- bond_assign_current_slave(bond, new);
+ if ((bond_mode == BOND_MODE_TLB) ||
+ (bond_mode == BOND_MODE_ALB)) {
+ bond_alb_assign_current_slave(bond, new);
+ } else {
+ bond->current_slave = new;
+ }
}
/**
@@ -2103,7 +2100,7 @@ static int bond_release_all(struct net_d
}
old_current = bond->current_slave;
- bond_assign_current_slave(bond, NULL);
+ change_active_interface(bond, NULL);
bond->current_arp_slave = NULL;
bond->primary_slave = NULL;
@@ -3128,7 +3125,7 @@ static int bond_xmit_roundrobin(struct s
dev_queue_xmit(skb);
write_lock(&bond->ptrlock);
- bond_assign_current_slave(bond, slave->next);
+ bond->current_slave = slave->next;
write_unlock(&bond->ptrlock);
read_unlock(&bond->lock);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-09-11 14:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-11 14:38 [PATCH 3/10] [bonding 2.6] fix assign_current_slave Amir Noam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).