Commit a742e1f5 authored by dingtianhong's avatar dingtianhong Committed by David S. Miller

bonding: slight optimization for bond_3ad_xmit_xor()

The bond_dev_queue_xmit() will always return 0, and as a fast path,
it is inappropriate to check the res value when xmit every package,
so remove the res check and avoid once judgement for xmit.
Signed-off-by: default avatarDing Tianhong <dingtianhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 815117ad
...@@ -2401,13 +2401,12 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) ...@@ -2401,13 +2401,12 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
struct list_head *iter; struct list_head *iter;
int slaves_in_agg; int slaves_in_agg;
int slave_agg_no; int slave_agg_no;
int res = 1;
int agg_id; int agg_id;
if (__bond_3ad_get_active_agg_info(bond, &ad_info)) { if (__bond_3ad_get_active_agg_info(bond, &ad_info)) {
pr_debug("%s: Error: __bond_3ad_get_active_agg_info failed\n", pr_debug("%s: Error: __bond_3ad_get_active_agg_info failed\n",
dev->name); dev->name);
goto out; goto err_free;
} }
slaves_in_agg = ad_info.ports; slaves_in_agg = ad_info.ports;
...@@ -2415,7 +2414,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) ...@@ -2415,7 +2414,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
if (slaves_in_agg == 0) { if (slaves_in_agg == 0) {
pr_debug("%s: Error: active aggregator is empty\n", dev->name); pr_debug("%s: Error: active aggregator is empty\n", dev->name);
goto out; goto err_free;
} }
slave_agg_no = bond_xmit_hash(bond, skb, slaves_in_agg); slave_agg_no = bond_xmit_hash(bond, skb, slaves_in_agg);
...@@ -2434,7 +2433,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) ...@@ -2434,7 +2433,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
} }
if (SLAVE_IS_OK(slave)) { if (SLAVE_IS_OK(slave)) {
res = bond_dev_queue_xmit(bond, skb, slave->dev); bond_dev_queue_xmit(bond, skb, slave->dev);
goto out; goto out;
} }
} }
...@@ -2442,21 +2441,22 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) ...@@ -2442,21 +2441,22 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
if (slave_agg_no >= 0) { if (slave_agg_no >= 0) {
pr_err("%s: Error: Couldn't find a slave to tx on for aggregator ID %d\n", pr_err("%s: Error: Couldn't find a slave to tx on for aggregator ID %d\n",
dev->name, agg_id); dev->name, agg_id);
goto out; goto err_free;
} }
/* we couldn't find any suitable slave after the agg_no, so use the /* we couldn't find any suitable slave after the agg_no, so use the
* first suitable found, if found. */ * first suitable found, if found. */
if (first_ok_slave) if (first_ok_slave)
res = bond_dev_queue_xmit(bond, skb, first_ok_slave->dev); bond_dev_queue_xmit(bond, skb, first_ok_slave->dev);
else
goto err_free;
out: out:
if (res) {
/* no suitable interface, frame not sent */
kfree_skb(skb);
}
return NETDEV_TX_OK; return NETDEV_TX_OK;
err_free:
/* no suitable interface, frame not sent */
kfree_skb(skb);
goto out;
} }
int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond, int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment