Commit 70f13990 authored by Jeff Garzik's avatar Jeff Garzik

Merge pobox.com:/garz/repo/netdev-2.6/bonding

into pobox.com:/garz/repo/net-drivers-2.6
parents 1c99af21 d276a594
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -47,16 +47,13 @@ config BONDING
---help---
Say 'Y' or 'M' if you wish to be able to 'bond' multiple Ethernet
Channels together. This is called 'Etherchannel' by Cisco,
'Trunking' by Sun, and 'Bonding' in Linux.
'Trunking' by Sun, 802.3ad by the IEEE, and 'Bonding' in Linux.
If you have two Ethernet connections to some other computer, you can
make them behave like one double speed connection using this driver.
Naturally, this has to be supported at the other end as well, either
with a similar Bonding Linux driver, a Cisco 5500 switch or a
SunTrunking SunSoft driver.
The driver supports multiple bonding modes to allow for both high
perfomance and high availability operation.
This is similar to the EQL driver, but it merges Ethernet segments
instead of serial lines.
Refer to <file:Documentation/networking/bonding.txt> for more
information.
To compile this driver as a module, choose M here: the module
will be called bonding.
......
......@@ -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;
......@@ -1849,8 +1849,8 @@ static int bond_enslave(struct net_device *bond_dev, struct net_device *slave_de
if (bond_update_speed_duplex(new_slave) &&
(new_slave->link != BOND_LINK_DOWN)) {
printk(KERN_WARNING DRV_NAME
": Warning: failed to get speed/duplex from %s, speed "
"forced to 100Mbps, duplex forced to Full.\n",
": Warning: failed to get speed and duplex from %s, "
"assumed to be 100Mb/sec and Full.\n",
new_slave->dev->name);
if (bond->params.mode == BOND_MODE_8023AD) {
......@@ -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,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) {
int tmp_res;
if (slave->dev->change_mtu) {
tmp_res = slave->dev->change_mtu(slave->dev, 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);
}
} else {
slave->dev->mtu = bond_dev->mtu;
}
}
return res;
......@@ -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);
......
......@@ -678,6 +678,8 @@ extern unsigned dev_get_flags(const struct net_device *);
extern int dev_change_flags(struct net_device *, unsigned);
extern int dev_change_name(struct net_device *, char *);
extern int dev_set_mtu(struct net_device *, int);
extern int dev_set_mac_address(struct net_device *,
struct sockaddr *);
extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev);
extern void dev_init(void);
......
......@@ -2300,6 +2300,21 @@ int dev_set_mtu(struct net_device *dev, int new_mtu)
return err;
}
int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa)
{
int err;
if (!dev->set_mac_address)
return -EOPNOTSUPP;
if (sa->sa_family != dev->type)
return -EINVAL;
if (!netif_device_present(dev))
return -ENODEV;
err = dev->set_mac_address(dev, sa);
if (!err)
notifier_call_chain(&netdev_chain, NETDEV_CHANGEADDR, dev);
return err;
}
/*
* Perform the SIOCxIFxxx calls.
......@@ -2346,17 +2361,7 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd)
return 0;
case SIOCSIFHWADDR:
if (!dev->set_mac_address)
return -EOPNOTSUPP;
if (ifr->ifr_hwaddr.sa_family != dev->type)
return -EINVAL;
if (!netif_device_present(dev))
return -ENODEV;
err = dev->set_mac_address(dev, &ifr->ifr_hwaddr);
if (!err)
notifier_call_chain(&netdev_chain,
NETDEV_CHANGEADDR, dev);
return err;
return dev_set_mac_address(dev, &ifr->ifr_hwaddr);
case SIOCSIFHWBROADCAST:
if (ifr->ifr_hwaddr.sa_family != dev->type)
......@@ -3322,6 +3327,7 @@ EXPORT_SYMBOL(dev_set_allmulti);
EXPORT_SYMBOL(dev_set_promiscuity);
EXPORT_SYMBOL(dev_change_flags);
EXPORT_SYMBOL(dev_set_mtu);
EXPORT_SYMBOL(dev_set_mac_address);
EXPORT_SYMBOL(free_netdev);
EXPORT_SYMBOL(netdev_boot_setup_check);
EXPORT_SYMBOL(netdev_set_master);
......
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