Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=872254dd6b1f80cb95ee9e2e22980888533fc293
Commit:     872254dd6b1f80cb95ee9e2e22980888533fc293
Parent:     200d1713b47200aa478f27e454e3d957264d49be
Author:     Moni Shoua <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 9 19:43:38 2007 -0700
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Mon Oct 15 14:20:45 2007 -0400

    net/bonding: Enable bonding to enslave non ARPHRD_ETHER
    
    This patch changes some of the bond netdevice attributes and functions
    to be that of the active slave for the case of the enslaved device not being
    of ARPHRD_ETHER type. Basically it overrides those setting done by 
ether_setup(),
    which are netdevice **type** dependent and hence might be not appropriate 
for
    devices of other types. It also enforces mutual exclusion on bonding slaves
    from dissimilar ether types, as was concluded over the v1 discussion.
    
    IPoIB (see Documentation/infiniband/ipoib.txt) MAC address is made of a 3 
bytes
    IB QP (Queue Pair) number and 16 bytes IB port GID (Global ID) of the port 
this
    IPoIB device is bounded to. The QP is a resource created by the IB HW and 
the
    GID is an identifier burned into the HCA (i have omitted here some details 
which
    are not important for the bonding RFC).
    
    Signed-off-by: Moni Shoua <monis at voltaire.com>
    Signed-off-by: Or Gerlitz <ogerlitz at voltaire.com>
    Acked-by: Jay Vosburgh <[EMAIL PROTECTED]>
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 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 64bfec3..6ae4593 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)
        return 0;
 }
 
+
+static void bond_setup_by_slave(struct net_device *bond_dev,
+                               struct net_device *slave_dev)
+{
+       bond_dev->neigh_setup           = slave_dev->neigh_setup;
+
+       bond_dev->type              = slave_dev->type;
+       bond_dev->hard_header_len   = slave_dev->hard_header_len;
+       bond_dev->addr_len          = slave_dev->addr_len;
+
+       memcpy(bond_dev->broadcast, slave_dev->broadcast,
+               slave_dev->addr_len);
+}
+
 /* enslave device <slave> to bond device <master> */
 int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
 {
@@ -1312,6 +1326,25 @@ int bond_enslave(struct net_device *bond_dev, struct 
net_device *slave_dev)
                goto err_undo_flags;
        }
 
+       /* set bonding device ether type by slave - bonding netdevices are
+        * created with ether_setup, so when the slave type is not ARPHRD_ETHER
+        * there is a need to override some of the type dependent attribs/funcs.
+        *
+        * bond ether type mutual exclusion - don't allow slaves of dissimilar
+        * ether type (eg ARPHRD_ETHER and ARPHRD_INFINIBAND) share the same 
bond
+        */
+       if (bond->slave_cnt == 0) {
+               if (slave_dev->type != ARPHRD_ETHER)
+                       bond_setup_by_slave(bond_dev, slave_dev);
+       } else if (bond_dev->type != slave_dev->type) {
+               printk(KERN_ERR DRV_NAME ": %s ether type (%d) is different "
+                       "from other slaves (%d), can not enslave it.\n",
+                       slave_dev->name,
+                       slave_dev->type, bond_dev->type);
+                       res = -EINVAL;
+                       goto err_undo_flags;
+       }
+
        if (slave_dev->set_mac_address == NULL) {
                printk(KERN_ERR DRV_NAME
                        ": %s: Error: The slave device you specified does "
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to