Commit 8169d10c authored by David S. Miller's avatar David S. Miller

Merge branch 'bonding'

Ding Tianhong says:

====================
bonding: slight optimization for bonding

This serious of patches will slight optimize the mac address compare
and xmit path for bonding, also make some cleanups.

Julia was using ether_addr_equal_64bits to instead of ether_addr_equal,
it is really a hard work and she may did not make patch for bonding yet,
so I have do it in this patchset and that she could miss the bonding drivers.

resend and add cc for Julia.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4b903e30 844223ab
This diff is collapsed.
...@@ -265,7 +265,7 @@ struct ad_slave_info { ...@@ -265,7 +265,7 @@ struct ad_slave_info {
// ================= AD Exported functions to the main bonding code ================== // ================= AD Exported functions to the main bonding code ==================
void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution); void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution);
int bond_3ad_bind_slave(struct slave *slave); void bond_3ad_bind_slave(struct slave *slave);
void bond_3ad_unbind_slave(struct slave *slave); void bond_3ad_unbind_slave(struct slave *slave);
void bond_3ad_state_machine_handler(struct work_struct *); void bond_3ad_state_machine_handler(struct work_struct *);
void bond_3ad_initiate_agg_selection(struct bonding *bond, int timeout); void bond_3ad_initiate_agg_selection(struct bonding *bond, int timeout);
......
...@@ -1371,7 +1371,6 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev) ...@@ -1371,7 +1371,6 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
int do_tx_balance = 1; int do_tx_balance = 1;
u32 hash_index = 0; u32 hash_index = 0;
const u8 *hash_start = NULL; const u8 *hash_start = NULL;
int res = 1;
struct ipv6hdr *ip6hdr; struct ipv6hdr *ip6hdr;
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
...@@ -1469,7 +1468,8 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev) ...@@ -1469,7 +1468,8 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
ETH_ALEN); ETH_ALEN);
} }
res = bond_dev_queue_xmit(bond, skb, tx_slave->dev); bond_dev_queue_xmit(bond, skb, tx_slave->dev);
goto out;
} else { } else {
if (tx_slave) { if (tx_slave) {
_lock_tx_hashtbl(bond); _lock_tx_hashtbl(bond);
...@@ -1478,11 +1478,9 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev) ...@@ -1478,11 +1478,9 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
} }
} }
if (res) { /* no suitable interface, frame not sent */
/* no suitable interface, frame not sent */ kfree_skb(skb);
kfree_skb(skb); out:
}
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
......
...@@ -304,7 +304,7 @@ const char *bond_mode_name(int mode) ...@@ -304,7 +304,7 @@ const char *bond_mode_name(int mode)
* @skb: hw accel VLAN tagged skb to transmit * @skb: hw accel VLAN tagged skb to transmit
* @slave_dev: slave that is supposed to xmit this skbuff * @slave_dev: slave that is supposed to xmit this skbuff
*/ */
int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, void bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
struct net_device *slave_dev) struct net_device *slave_dev)
{ {
skb->dev = slave_dev; skb->dev = slave_dev;
...@@ -317,8 +317,6 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, ...@@ -317,8 +317,6 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb); bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb);
else else
dev_queue_xmit(skb); dev_queue_xmit(skb);
return 0;
} }
/* /*
...@@ -1639,7 +1637,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) ...@@ -1639,7 +1637,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
err_undo_flags: err_undo_flags:
/* Enslave of first slave has failed and we need to fix master's mac */ /* Enslave of first slave has failed and we need to fix master's mac */
if (!bond_has_slaves(bond) && if (!bond_has_slaves(bond) &&
ether_addr_equal(bond_dev->dev_addr, slave_dev->dev_addr)) ether_addr_equal_64bits(bond_dev->dev_addr, slave_dev->dev_addr))
eth_hw_addr_random(bond_dev); eth_hw_addr_random(bond_dev);
return res; return res;
...@@ -1712,7 +1710,7 @@ static int __bond_release_one(struct net_device *bond_dev, ...@@ -1712,7 +1710,7 @@ static int __bond_release_one(struct net_device *bond_dev,
bond->current_arp_slave = NULL; bond->current_arp_slave = NULL;
if (!all && !bond->params.fail_over_mac) { if (!all && !bond->params.fail_over_mac) {
if (ether_addr_equal(bond_dev->dev_addr, slave->perm_hwaddr) && if (ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) &&
bond_has_slaves(bond)) bond_has_slaves(bond))
pr_warn("%s: Warning: the permanent HWaddr of %s - %pM - is still in use by %s. Set the HWaddr of %s to a different address to avoid conflicts.\n", pr_warn("%s: Warning: the permanent HWaddr of %s - %pM - is still in use by %s. Set the HWaddr of %s to a different address to avoid conflicts.\n",
bond_dev->name, slave_dev->name, bond_dev->name, slave_dev->name,
...@@ -3673,28 +3671,24 @@ static inline int bond_slave_override(struct bonding *bond, ...@@ -3673,28 +3671,24 @@ static inline int bond_slave_override(struct bonding *bond,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct slave *slave = NULL; struct slave *slave = NULL;
struct slave *check_slave;
struct list_head *iter; struct list_head *iter;
int res = 1;
if (!skb->queue_mapping) if (!skb->queue_mapping)
return 1; return 1;
/* Find out if any slaves have the same mapping as this skb. */ /* Find out if any slaves have the same mapping as this skb. */
bond_for_each_slave_rcu(bond, check_slave, iter) { bond_for_each_slave_rcu(bond, slave, iter) {
if (check_slave->queue_id == skb->queue_mapping) { if (slave->queue_id == skb->queue_mapping) {
slave = check_slave; if (slave_can_tx(slave)) {
bond_dev_queue_xmit(bond, skb, slave->dev);
return 0;
}
/* If the slave isn't UP, use default transmit policy. */
break; break;
} }
} }
/* If the slave isn't UP, use default transmit policy. */ return 1;
if (slave && slave->queue_id && IS_UP(slave->dev) &&
(slave->link == BOND_LINK_UP)) {
res = bond_dev_queue_xmit(bond, skb, slave->dev);
}
return res;
} }
......
...@@ -416,7 +416,7 @@ static inline bool slave_can_tx(struct slave *slave) ...@@ -416,7 +416,7 @@ static inline bool slave_can_tx(struct slave *slave)
struct bond_net; struct bond_net;
int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, struct slave *slave); int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, struct slave *slave);
int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev); void bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev);
int bond_create(struct net *net, const char *name); int bond_create(struct net *net, const char *name);
int bond_create_sysfs(struct bond_net *net); int bond_create_sysfs(struct bond_net *net);
void bond_destroy_sysfs(struct bond_net *net); void bond_destroy_sysfs(struct bond_net *net);
......
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