diff options
author | Joe Perches <joe@perches.com> | 2014-02-15 16:02:17 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-02-17 00:29:23 -0500 |
commit | ada0f8633c5b8dad640e1a2bcb95499ec187ac17 (patch) | |
tree | 4320eccba2fcbfd3005ce48fd226b2eafbb0d2f0 /drivers/net/bonding/bond_main.c | |
parent | 2ea24f2ecfdca1039cf9a9dab92ac1769224fe92 (diff) | |
download | lwn-ada0f8633c5b8dad640e1a2bcb95499ec187ac17.tar.gz lwn-ada0f8633c5b8dad640e1a2bcb95499ec187ac17.zip |
bonding: Convert memcpy(foo, bar, ETH_ALEN) to ether_addr_copy(foo, bar)
ether_addr_copy is smaller and faster for some architectures.
This relies on a stack frame being at least __aligned(2)
for one use of an Ethernet address on the stack.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 90994ed31eb4..3bce855e627b 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -673,12 +673,12 @@ static void bond_do_fail_over_mac(struct bonding *bond, write_unlock_bh(&bond->curr_slave_lock); if (old_active) { - memcpy(tmp_mac, new_active->dev->dev_addr, ETH_ALEN); + ether_addr_copy(tmp_mac, new_active->dev->dev_addr); memcpy(saddr.sa_data, old_active->dev->dev_addr, ETH_ALEN); saddr.sa_family = new_active->dev->type; } else { - memcpy(saddr.sa_data, bond->dev->dev_addr, ETH_ALEN); + ether_addr_copy(saddr.sa_data, bond->dev->dev_addr); saddr.sa_family = bond->dev->type; } @@ -692,7 +692,7 @@ static void bond_do_fail_over_mac(struct bonding *bond, if (!old_active) goto out; - memcpy(saddr.sa_data, tmp_mac, ETH_ALEN); + ether_addr_copy(saddr.sa_data, tmp_mac); saddr.sa_family = old_active->dev->type; rv = dev_set_mac_address(old_active->dev, &saddr); @@ -1316,7 +1316,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) * that need it, and for restoring it upon release, and then * set it to the master's address */ - memcpy(new_slave->perm_hwaddr, slave_dev->dev_addr, ETH_ALEN); + ether_addr_copy(new_slave->perm_hwaddr, slave_dev->dev_addr); if (!bond->params.fail_over_mac || bond->params.mode != BOND_MODE_ACTIVEBACKUP) { @@ -1587,7 +1587,7 @@ err_restore_mac: * MAC if this slave's MAC is in use by the bond, or at * least print a warning. */ - memcpy(addr.sa_data, new_slave->perm_hwaddr, ETH_ALEN); + ether_addr_copy(addr.sa_data, new_slave->perm_hwaddr); addr.sa_family = slave_dev->type; dev_set_mac_address(slave_dev, &addr); } @@ -1776,7 +1776,7 @@ static int __bond_release_one(struct net_device *bond_dev, if (bond->params.fail_over_mac != BOND_FOM_ACTIVE || bond->params.mode != BOND_MODE_ACTIVEBACKUP) { /* restore original ("permanent") mac address */ - memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); + ether_addr_copy(addr.sa_data, slave->perm_hwaddr); addr.sa_family = slave_dev->type; dev_set_mac_address(slave_dev, &addr); } |