Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 352005
b: refs/heads/master
c: 409cc1f
h: refs/heads/master
i:
  352003: c47f008
v: v3
  • Loading branch information
Jiri Pirko authored and David S. Miller committed Jan 30, 2013
1 parent 9cb029c commit ae00b7f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d2ed273d30c5ffd14f6b5ec7ecc751d960f832fc
refs/heads/master: 409cc1f8a4149c26bbb8e5d3bacb36541ad371e2
38 changes: 19 additions & 19 deletions trunk/drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1320,14 +1320,15 @@ static void bond_netpoll_cleanup(struct net_device *bond_dev)

/*---------------------------------- IOCTL ----------------------------------*/

static int bond_sethwaddr(struct net_device *bond_dev,
struct net_device *slave_dev)
static void bond_set_dev_addr(struct net_device *bond_dev,
struct net_device *slave_dev)
{
pr_debug("bond_dev=%p\n", bond_dev);
pr_debug("slave_dev=%p\n", slave_dev);
pr_debug("slave_dev->addr_len=%d\n", slave_dev->addr_len);
memcpy(bond_dev->dev_addr, slave_dev->dev_addr, slave_dev->addr_len);
return 0;
bond_dev->addr_assign_type = NET_ADDR_SET;
call_netdevice_notifiers(NETDEV_CHANGEADDR, bond_dev);
}

static netdev_features_t bond_fix_features(struct net_device *dev,
Expand Down Expand Up @@ -1628,10 +1629,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)

/* If this is the first slave, then we need to set the master's hardware
* address to be the same as the slave's. */
if (is_zero_ether_addr(bond->dev->dev_addr))
memcpy(bond->dev->dev_addr, slave_dev->dev_addr,
slave_dev->addr_len);

if (bond->dev_addr_from_first)
bond_set_dev_addr(bond->dev, slave_dev);

new_slave = kzalloc(sizeof(struct slave), GFP_KERNEL);
if (!new_slave) {
Expand Down Expand Up @@ -2048,12 +2047,8 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)

if (bond->slave_cnt == 0) {
bond_set_carrier(bond);

/* if the last slave was removed, zero the mac address
* of the master so it will be set by the application
* to the mac address of the first slave
*/
memset(bond_dev->dev_addr, 0, bond_dev->addr_len);
eth_hw_addr_random(bond_dev);
bond->dev_addr_from_first = true;

if (bond_vlan_used(bond)) {
pr_warning("%s: Warning: clearing HW address of %s while it still has VLANs.\n",
Expand Down Expand Up @@ -2234,11 +2229,8 @@ static int bond_release_all(struct net_device *bond_dev)
write_lock_bh(&bond->lock);
}

/* zero the mac address of the master so it will be
* set by the application to the mac address of the
* first slave
*/
memset(bond_dev->dev_addr, 0, bond_dev->addr_len);
eth_hw_addr_random(bond_dev);
bond->dev_addr_from_first = true;

if (bond_vlan_used(bond)) {
pr_warning("%s: Warning: clearing HW address of %s while it still has VLANs.\n",
Expand Down Expand Up @@ -3708,7 +3700,8 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
break;
case BOND_SETHWADDR_OLD:
case SIOCBONDSETHWADDR:
res = bond_sethwaddr(bond_dev, slave_dev);
bond_set_dev_addr(bond_dev, slave_dev);
res = 0;
break;
case BOND_CHANGE_ACTIVE_OLD:
case SIOCBONDCHANGEACTIVE:
Expand Down Expand Up @@ -4858,6 +4851,13 @@ static int bond_init(struct net_device *bond_dev)

bond_debug_register(bond);

/* Ensure valid dev_addr */
if (is_zero_ether_addr(bond_dev->dev_addr) &&
bond_dev->addr_assign_type == NET_ADDR_PERM) {
eth_hw_addr_random(bond_dev);
bond->dev_addr_from_first = true;
}

__hw_addr_init(&bond->mc_list);
return 0;
}
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/bonding/bonding.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ struct bonding {
/* debugging support via debugfs */
struct dentry *debug_dir;
#endif /* CONFIG_DEBUG_FS */
bool dev_addr_from_first;
};

static inline bool bond_vlan_used(struct bonding *bond)
Expand Down

0 comments on commit ae00b7f

Please sign in to comment.