aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r--drivers/net/bonding/bond_main.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index ed361d62d702..862ed8ece14e 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4057,8 +4057,7 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev
4057{ 4057{
4058 struct bonding *bond = bond_dev->priv; 4058 struct bonding *bond = bond_dev->priv;
4059 struct slave *slave, *start_at; 4059 struct slave *slave, *start_at;
4060 int i; 4060 int i, slave_no, res = 1;
4061 int res = 1;
4062 4061
4063 read_lock(&bond->lock); 4062 read_lock(&bond->lock);
4064 4063
@@ -4066,29 +4065,29 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev
4066 goto out; 4065 goto out;
4067 } 4066 }
4068 4067
4069 read_lock(&bond->curr_slave_lock); 4068 /*
4070 slave = start_at = bond->curr_active_slave; 4069 * Concurrent TX may collide on rr_tx_counter; we accept that
4071 read_unlock(&bond->curr_slave_lock); 4070 * as being rare enough not to justify using an atomic op here
4071 */
4072 slave_no = bond->rr_tx_counter++ % bond->slave_cnt;
4072 4073
4073 if (!slave) { 4074 bond_for_each_slave(bond, slave, i) {
4074 goto out; 4075 slave_no--;
4076 if (slave_no < 0) {
4077 break;
4078 }
4075 } 4079 }
4076 4080
4081 start_at = slave;
4077 bond_for_each_slave_from(bond, slave, i, start_at) { 4082 bond_for_each_slave_from(bond, slave, i, start_at) {
4078 if (IS_UP(slave->dev) && 4083 if (IS_UP(slave->dev) &&
4079 (slave->link == BOND_LINK_UP) && 4084 (slave->link == BOND_LINK_UP) &&
4080 (slave->state == BOND_STATE_ACTIVE)) { 4085 (slave->state == BOND_STATE_ACTIVE)) {
4081 res = bond_dev_queue_xmit(bond, skb, slave->dev); 4086 res = bond_dev_queue_xmit(bond, skb, slave->dev);
4082
4083 write_lock(&bond->curr_slave_lock);
4084 bond->curr_active_slave = slave->next;
4085 write_unlock(&bond->curr_slave_lock);
4086
4087 break; 4087 break;
4088 } 4088 }
4089 } 4089 }
4090 4090
4091
4092out: 4091out:
4093 if (res) { 4092 if (res) {
4094 /* no suitable interface, frame not sent */ 4093 /* no suitable interface, frame not sent */