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) ...@@ -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 */ /* each slave will receive packets destined to a different mac */
memcpy(s_addr.sa_data, addr, dev->addr_len); memcpy(s_addr.sa_data, addr, dev->addr_len);
s_addr.sa_family = dev->type; 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 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 " "mode requires that the base driver support setting "
"the hw address also when the network device's " "the hw address also when the network device's "
"interface is open\n", "interface is open\n",
...@@ -1209,7 +1209,7 @@ static int alb_set_mac_address(struct bonding *bond, void *addr) ...@@ -1209,7 +1209,7 @@ static int alb_set_mac_address(struct bonding *bond, void *addr)
/* save net_device's current hw address */ /* save net_device's current hw address */
memcpy(tmp_addr, slave->dev->dev_addr, ETH_ALEN); 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 */ /* restore net_device's hw address */
memcpy(slave->dev->dev_addr, tmp_addr, ETH_ALEN); memcpy(slave->dev->dev_addr, tmp_addr, ETH_ALEN);
...@@ -1229,7 +1229,7 @@ static int alb_set_mac_address(struct bonding *bond, void *addr) ...@@ -1229,7 +1229,7 @@ static int alb_set_mac_address(struct bonding *bond, void *addr)
stop_at = slave; stop_at = slave;
bond_for_each_slave_from_to(bond, slave, i, bond->first_slave, stop_at) { bond_for_each_slave_from_to(bond, slave, i, bond->first_slave, stop_at) {
memcpy(tmp_addr, slave->dev->dev_addr, ETH_ALEN); 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); 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 ...@@ -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); memcpy(addr.sa_data, bond_dev->dev_addr, bond_dev->addr_len);
addr.sa_family = slave_dev->type; 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) { if (res) {
dprintk("Error %d calling set_mac_address\n", res); dprintk("Error %d calling set_mac_address\n", res);
goto err_free; goto err_free;
...@@ -1991,7 +1991,7 @@ static int bond_enslave(struct net_device *bond_dev, struct net_device *slave_de ...@@ -1991,7 +1991,7 @@ static int bond_enslave(struct net_device *bond_dev, struct net_device *slave_de
err_restore_mac: err_restore_mac:
memcpy(addr.sa_data, new_slave->perm_hwaddr, ETH_ALEN); memcpy(addr.sa_data, new_slave->perm_hwaddr, ETH_ALEN);
addr.sa_family = slave_dev->type; addr.sa_family = slave_dev->type;
slave_dev->set_mac_address(slave_dev, &addr); dev_set_mac_address(slave_dev, &addr);
err_free: err_free:
kfree(new_slave); kfree(new_slave);
...@@ -2171,7 +2171,7 @@ static int bond_release(struct net_device *bond_dev, struct net_device *slave_de ...@@ -2171,7 +2171,7 @@ static int bond_release(struct net_device *bond_dev, struct net_device *slave_de
/* restore original ("permanent") mac address */ /* restore original ("permanent") mac address */
memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN);
addr.sa_family = slave_dev->type; 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 /* restore the original state of the
...@@ -2262,7 +2262,7 @@ static int bond_release_all(struct net_device *bond_dev) ...@@ -2262,7 +2262,7 @@ static int bond_release_all(struct net_device *bond_dev)
/* restore original ("permanent") mac address*/ /* restore original ("permanent") mac address*/
memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN);
addr.sa_family = slave_dev->type; 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 /* 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) ...@@ -3898,12 +3898,7 @@ static int bond_change_mtu(struct net_device *bond_dev, int new_mtu)
bond_for_each_slave(bond, slave, i) { bond_for_each_slave(bond, slave, i) {
dprintk("s %p s->p %p c_m %p\n", slave, dprintk("s %p s->p %p c_m %p\n", slave,
slave->prev, slave->dev->change_mtu); slave->prev, slave->dev->change_mtu);
if (slave->dev->change_mtu) { res = dev_set_mtu(slave->dev, new_mtu);
res = slave->dev->change_mtu(slave->dev, new_mtu);
} else {
slave->dev->mtu = new_mtu;
res = 0;
}
if (res) { if (res) {
/* If we failed to set the slave's mtu to the new value /* If we failed to set the slave's mtu to the new value
...@@ -3929,15 +3924,11 @@ static int bond_change_mtu(struct net_device *bond_dev, int new_mtu) ...@@ -3929,15 +3924,11 @@ 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) { bond_for_each_slave_from_to(bond, slave, i, bond->first_slave, stop_at) {
int tmp_res; int tmp_res;
if (slave->dev->change_mtu) { tmp_res = dev_set_mtu(slave->dev, bond_dev->mtu);
tmp_res = slave->dev->change_mtu(slave->dev, bond_dev->mtu);
if (tmp_res) { if (tmp_res) {
dprintk("unwind err %d dev %s\n", tmp_res, dprintk("unwind err %d dev %s\n", tmp_res,
slave->dev->name); slave->dev->name);
} }
} else {
slave->dev->mtu = bond_dev->mtu;
}
} }
return res; return res;
...@@ -3988,7 +3979,7 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr) ...@@ -3988,7 +3979,7 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr)
goto unwind; goto unwind;
} }
res = slave->dev->set_mac_address(slave->dev, addr); res = dev_set_mac_address(slave->dev, addr);
if (res) { if (res) {
/* TODO: consider downing the slave /* TODO: consider downing the slave
* and retry ? * and retry ?
...@@ -4014,7 +4005,7 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr) ...@@ -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) { bond_for_each_slave_from_to(bond, slave, i, bond->first_slave, stop_at) {
int tmp_res; 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) { if (tmp_res) {
dprintk("unwind err %d dev %s\n", tmp_res, dprintk("unwind err %d dev %s\n", tmp_res,
slave->dev->name); 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