aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authordingtianhong <dingtianhong@huawei.com>2014-01-01 20:13:06 -0500
committerDavid S. Miller <davem@davemloft.net>2014-01-01 22:58:15 -0500
commit3900f29021f0bc7fe9815aa32f1a993b7dfdd402 (patch)
treecc65a7ba5af8a6d4478122e37e202e654a338ac7 /drivers/net/bonding
parent4d4ac1b0927c046413f0e92c38a833335a2d7590 (diff)
bonding: slight optimizztion for bond_slave_override()
When the skb is xmit by the function bond_slave_override(), it will have duplicate judgement for slave state, and I think it will consumes a little performance, maybe it is negligible, so I simplify the function and remove the unwanted judgement. Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_main.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 06f3a9f344b3..9efccefbfb68 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3673,28 +3673,24 @@ static inline int bond_slave_override(struct bonding *bond,
3673 struct sk_buff *skb) 3673 struct sk_buff *skb)
3674{ 3674{
3675 struct slave *slave = NULL; 3675 struct slave *slave = NULL;
3676 struct slave *check_slave;
3677 struct list_head *iter; 3676 struct list_head *iter;
3678 int res = 1;
3679 3677
3680 if (!skb->queue_mapping) 3678 if (!skb->queue_mapping)
3681 return 1; 3679 return 1;
3682 3680
3683 /* Find out if any slaves have the same mapping as this skb. */ 3681 /* Find out if any slaves have the same mapping as this skb. */
3684 bond_for_each_slave_rcu(bond, check_slave, iter) { 3682 bond_for_each_slave_rcu(bond, slave, iter) {
3685 if (check_slave->queue_id == skb->queue_mapping) { 3683 if (slave->queue_id == skb->queue_mapping) {
3686 slave = check_slave; 3684 if (slave_can_tx(slave)) {
3685 bond_dev_queue_xmit(bond, skb, slave->dev);
3686 return 0;
3687 }
3688 /* If the slave isn't UP, use default transmit policy. */
3687 break; 3689 break;
3688 } 3690 }
3689 } 3691 }
3690 3692
3691 /* If the slave isn't UP, use default transmit policy. */ 3693 return 1;
3692 if (slave && slave->queue_id && IS_UP(slave->dev) &&
3693 (slave->link == BOND_LINK_UP)) {
3694 res = bond_dev_queue_xmit(bond, skb, slave->dev);
3695 }
3696
3697 return res;
3698} 3694}
3699 3695
3700 3696