Commit 0e7c2458 authored by Jay Vosburgh's avatar Jay Vosburgh Committed by Jeff Garzik

[PATCH] : bonding: use wrappers to change mtu and MAC

	This updates the bonding driver to use the dev_set_mtu() and
dev_set_mac_address() wrapper functions.
Signed-off-by: default avatarJay Vosburgh <fubar@us.ibm.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@pobox.com>
parent b3865596
......@@ -954,9 +954,9 @@ static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[], int hw)
/* each slave will receive packets destined to a different mac */
memcpy(s_addr.sa_data, addr, dev->addr_len);
s_addr.sa_family = dev->type;
if (dev->set_mac_address(dev, &s_addr)) {
if (dev_set_mac_address(dev, &s_addr)) {
printk(KERN_ERR DRV_NAME
": Error: dev->set_mac_address of dev %s failed! ALB "
": Error: dev_set_mac_address of dev %s failed! ALB "
"mode requires that the base driver support setting "
"the hw address also when the network device's "
"interface is open\n",
......@@ -1209,7 +1209,7 @@ static int alb_set_mac_address(struct bonding *bond, void *addr)
/* save net_device's current hw address */
memcpy(tmp_addr, slave->dev->dev_addr, ETH_ALEN);
res = slave->dev->set_mac_address(slave->dev, addr);
res = dev_set_mac_address(slave->dev, addr);
/* restore net_device's hw address */
memcpy(slave->dev->dev_addr, tmp_addr, ETH_ALEN);
......@@ -1229,7 +1229,7 @@ static int alb_set_mac_address(struct bonding *bond, void *addr)
stop_at = slave;
bond_for_each_slave_from_to(bond, slave, i, bond->first_slave, stop_at) {
memcpy(tmp_addr, slave->dev->dev_addr, ETH_ALEN);
slave->dev->set_mac_address(slave->dev, &sa);
dev_set_mac_address(slave->dev, &sa);
memcpy(slave->dev->dev_addr, tmp_addr, ETH_ALEN);
}
......
......@@ -1719,7 +1719,7 @@ static int bond_enslave(struct net_device *bond_dev, struct net_device *slave_de
*/
memcpy(addr.sa_data, bond_dev->dev_addr, bond_dev->addr_len);
addr.sa_family = slave_dev->type;
res = slave_dev->set_mac_address(slave_dev, &addr);
res = dev_set_mac_address(slave_dev, &addr);
if (res) {
dprintk("Error %d calling set_mac_address\n", res);
goto err_free;
......@@ -1991,7 +1991,7 @@ static int bond_enslave(struct net_device *bond_dev, struct net_device *slave_de
err_restore_mac:
memcpy(addr.sa_data, new_slave->perm_hwaddr, ETH_ALEN);
addr.sa_family = slave_dev->type;
slave_dev->set_mac_address(slave_dev, &addr);
dev_set_mac_address(slave_dev, &addr);
err_free:
kfree(new_slave);
......@@ -2171,7 +2171,7 @@ static int bond_release(struct net_device *bond_dev, struct net_device *slave_de
/* restore original ("permanent") mac address */
memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN);
addr.sa_family = slave_dev->type;
slave_dev->set_mac_address(slave_dev, &addr);
dev_set_mac_address(slave_dev, &addr);
}
/* restore the original state of the
......@@ -2262,7 +2262,7 @@ static int bond_release_all(struct net_device *bond_dev)
/* restore original ("permanent") mac address*/
memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN);
addr.sa_family = slave_dev->type;
slave_dev->set_mac_address(slave_dev, &addr);
dev_set_mac_address(slave_dev, &addr);
}
/* restore the original state of the IFF_NOARP flag that might have
......@@ -3898,12 +3898,7 @@ static int bond_change_mtu(struct net_device *bond_dev, int new_mtu)
bond_for_each_slave(bond, slave, i) {
dprintk("s %p s->p %p c_m %p\n", slave,
slave->prev, slave->dev->change_mtu);
if (slave->dev->change_mtu) {
res = slave->dev->change_mtu(slave->dev, new_mtu);
} else {
slave->dev->mtu = new_mtu;
res = 0;
}
res = dev_set_mtu(slave->dev, new_mtu);
if (res) {
/* If we failed to set the slave's mtu to the new value
......@@ -3929,14 +3924,10 @@ static int bond_change_mtu(struct net_device *bond_dev, int new_mtu)
bond_for_each_slave_from_to(bond, slave, i, bond->first_slave, stop_at) {
int tmp_res;
if (slave->dev->change_mtu) {
tmp_res = slave->dev->change_mtu(slave->dev, bond_dev->mtu);
if (tmp_res) {
dprintk("unwind err %d dev %s\n", tmp_res,
slave->dev->name);
}
} else {
slave->dev->mtu = bond_dev->mtu;
tmp_res = dev_set_mtu(slave->dev, bond_dev->mtu);
if (tmp_res) {
dprintk("unwind err %d dev %s\n", tmp_res,
slave->dev->name);
}
}
......@@ -3988,7 +3979,7 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr)
goto unwind;
}
res = slave->dev->set_mac_address(slave->dev, addr);
res = dev_set_mac_address(slave->dev, addr);
if (res) {
/* TODO: consider downing the slave
* and retry ?
......@@ -4014,7 +4005,7 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr)
bond_for_each_slave_from_to(bond, slave, i, bond->first_slave, stop_at) {
int tmp_res;
tmp_res = slave->dev->set_mac_address(slave->dev, &tmp_sa);
tmp_res = dev_set_mac_address(slave->dev, &tmp_sa);
if (tmp_res) {
dprintk("unwind err %d dev %s\n", tmp_res,
slave->dev->name);
......
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