diff options
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 64bfec32e2a6..6ae45931d1b2 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1238,6 +1238,20 @@ static int bond_compute_features(struct bonding *bond) | |||
1238 | return 0; | 1238 | return 0; |
1239 | } | 1239 | } |
1240 | 1240 | ||
1241 | |||
1242 | static void bond_setup_by_slave(struct net_device *bond_dev, | ||
1243 | struct net_device *slave_dev) | ||
1244 | { | ||
1245 | bond_dev->neigh_setup = slave_dev->neigh_setup; | ||
1246 | |||
1247 | bond_dev->type = slave_dev->type; | ||
1248 | bond_dev->hard_header_len = slave_dev->hard_header_len; | ||
1249 | bond_dev->addr_len = slave_dev->addr_len; | ||
1250 | |||
1251 | memcpy(bond_dev->broadcast, slave_dev->broadcast, | ||
1252 | slave_dev->addr_len); | ||
1253 | } | ||
1254 | |||
1241 | /* enslave device <slave> to bond device <master> */ | 1255 | /* enslave device <slave> to bond device <master> */ |
1242 | int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | 1256 | int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) |
1243 | { | 1257 | { |
@@ -1312,6 +1326,25 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1312 | goto err_undo_flags; | 1326 | goto err_undo_flags; |
1313 | } | 1327 | } |
1314 | 1328 | ||
1329 | /* set bonding device ether type by slave - bonding netdevices are | ||
1330 | * created with ether_setup, so when the slave type is not ARPHRD_ETHER | ||
1331 | * there is a need to override some of the type dependent attribs/funcs. | ||
1332 | * | ||
1333 | * bond ether type mutual exclusion - don't allow slaves of dissimilar | ||
1334 | * ether type (eg ARPHRD_ETHER and ARPHRD_INFINIBAND) share the same bond | ||
1335 | */ | ||
1336 | if (bond->slave_cnt == 0) { | ||
1337 | if (slave_dev->type != ARPHRD_ETHER) | ||
1338 | bond_setup_by_slave(bond_dev, slave_dev); | ||
1339 | } else if (bond_dev->type != slave_dev->type) { | ||
1340 | printk(KERN_ERR DRV_NAME ": %s ether type (%d) is different " | ||
1341 | "from other slaves (%d), can not enslave it.\n", | ||
1342 | slave_dev->name, | ||
1343 | slave_dev->type, bond_dev->type); | ||
1344 | res = -EINVAL; | ||
1345 | goto err_undo_flags; | ||
1346 | } | ||
1347 | |||
1315 | if (slave_dev->set_mac_address == NULL) { | 1348 | if (slave_dev->set_mac_address == NULL) { |
1316 | printk(KERN_ERR DRV_NAME | 1349 | printk(KERN_ERR DRV_NAME |
1317 | ": %s: Error: The slave device you specified does " | 1350 | ": %s: Error: The slave device you specified does " |