aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorMoni Shoua <monis@voltaire.com>2007-10-09 22:43:41 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-15 14:20:46 -0400
commit3158bf7d414b69fdc0c715d0a4d82e12b74ef974 (patch)
tree48fceb771712a8b93ae02269facd29de7d37f70c /drivers/net
parent6b1bf096508c870889c2be63c7757a04d72116fe (diff)
net/bonding: Handlle wrong assumptions that slave is always an Ethernet device
bonding sometimes uses Ethernet constants (such as MTU and address length) which are not good when it enslaves non Ethernet devices (such as InfiniBand). Signed-off-by: Moni Shoua <monis at voltaire.com> Acked-by: Jay Vosburgh <fubar@us.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_main.c3
-rw-r--r--drivers/net/bonding/bond_sysfs.c10
-rw-r--r--drivers/net/bonding/bonding.h1
3 files changed, 11 insertions, 3 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 3eebfe287533..7be23364a9d6 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1225,7 +1225,8 @@ static int bond_compute_features(struct bonding *bond)
1225 struct slave *slave; 1225 struct slave *slave;
1226 struct net_device *bond_dev = bond->dev; 1226 struct net_device *bond_dev = bond->dev;
1227 unsigned long features = bond_dev->features; 1227 unsigned long features = bond_dev->features;
1228 unsigned short max_hard_header_len = ETH_HLEN; 1228 unsigned short max_hard_header_len = max((u16)ETH_HLEN,
1229 bond_dev->hard_header_len);
1229 int i; 1230 int i;
1230 1231
1231 features &= ~(NETIF_F_ALL_CSUM | BOND_VLAN_FEATURES); 1232 features &= ~(NETIF_F_ALL_CSUM | BOND_VLAN_FEATURES);
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index ca4e429f9ec2..583c568e1764 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -260,6 +260,7 @@ static ssize_t bonding_store_slaves(struct device *d,
260 char command[IFNAMSIZ + 1] = { 0, }; 260 char command[IFNAMSIZ + 1] = { 0, };
261 char *ifname; 261 char *ifname;
262 int i, res, found, ret = count; 262 int i, res, found, ret = count;
263 u32 original_mtu;
263 struct slave *slave; 264 struct slave *slave;
264 struct net_device *dev = NULL; 265 struct net_device *dev = NULL;
265 struct bonding *bond = to_bond(d); 266 struct bonding *bond = to_bond(d);
@@ -325,6 +326,7 @@ static ssize_t bonding_store_slaves(struct device *d,
325 } 326 }
326 327
327 /* Set the slave's MTU to match the bond */ 328 /* Set the slave's MTU to match the bond */
329 original_mtu = dev->mtu;
328 if (dev->mtu != bond->dev->mtu) { 330 if (dev->mtu != bond->dev->mtu) {
329 if (dev->change_mtu) { 331 if (dev->change_mtu) {
330 res = dev->change_mtu(dev, 332 res = dev->change_mtu(dev,
@@ -339,6 +341,9 @@ static ssize_t bonding_store_slaves(struct device *d,
339 } 341 }
340 rtnl_lock(); 342 rtnl_lock();
341 res = bond_enslave(bond->dev, dev); 343 res = bond_enslave(bond->dev, dev);
344 bond_for_each_slave(bond, slave, i)
345 if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0)
346 slave->original_mtu = original_mtu;
342 rtnl_unlock(); 347 rtnl_unlock();
343 if (res) { 348 if (res) {
344 ret = res; 349 ret = res;
@@ -351,6 +356,7 @@ static ssize_t bonding_store_slaves(struct device *d,
351 bond_for_each_slave(bond, slave, i) 356 bond_for_each_slave(bond, slave, i)
352 if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) { 357 if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) {
353 dev = slave->dev; 358 dev = slave->dev;
359 original_mtu = slave->original_mtu;
354 break; 360 break;
355 } 361 }
356 if (dev) { 362 if (dev) {
@@ -365,9 +371,9 @@ static ssize_t bonding_store_slaves(struct device *d,
365 } 371 }
366 /* set the slave MTU to the default */ 372 /* set the slave MTU to the default */
367 if (dev->change_mtu) { 373 if (dev->change_mtu) {
368 dev->change_mtu(dev, 1500); 374 dev->change_mtu(dev, original_mtu);
369 } else { 375 } else {
370 dev->mtu = 1500; 376 dev->mtu = original_mtu;
371 } 377 }
372 } 378 }
373 else { 379 else {
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 5011ba9e4661..ad9c632f88e4 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -156,6 +156,7 @@ struct slave {
156 s8 link; /* one of BOND_LINK_XXXX */ 156 s8 link; /* one of BOND_LINK_XXXX */
157 s8 state; /* one of BOND_STATE_XXXX */ 157 s8 state; /* one of BOND_STATE_XXXX */
158 u32 original_flags; 158 u32 original_flags;
159 u32 original_mtu;
159 u32 link_failure_count; 160 u32 link_failure_count;
160 u16 speed; 161 u16 speed;
161 u8 duplex; 162 u8 duplex;