]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
ib/ipoib: add broadcast_scope attribute to child devices ib_router
authorRolf Manderscheid <rvm@obsidianresearch.com>
Tue, 11 Dec 2007 17:12:43 +0000 (09:12 -0800)
committerSean Hefty <sean.hefty@intel.com>
Tue, 11 Dec 2007 17:12:43 +0000 (09:12 -0800)
This patch just makes child devices slightly more consistent
with parent devices with respect to configuring the scope.
It allows the administrator to correct the scope after the
child has already been created.  The scope argument to
create_child is still needed to support a parent device with
default scope and a child device within the same partition.

Signed-off-by: Rolf Manderscheid <rvm@obsidianresearch.com>
drivers/infiniband/ulp/ipoib/ipoib.h
drivers/infiniband/ulp/ipoib/ipoib_main.c
drivers/infiniband/ulp/ipoib/ipoib_vlan.c

index 2802ad2af421cd655e6fefa90e6ba4b605ac5e54..2262d868c5ac4be760c0dc12a413c70abd704df3 100644 (file)
@@ -386,6 +386,7 @@ static inline void ipoib_put_ah(struct ipoib_ah *ah)
 
 int ipoib_open(struct net_device *dev);
 int ipoib_add_pkey_attr(struct net_device *dev);
+int ipoib_add_broadcast_scope_attr(struct net_device *dev);
 int ipoib_add_umcast_attr(struct net_device *dev);
 
 void ipoib_send(struct net_device *dev, struct sk_buff *skb,
index 6ce0a8865ce4c786e93652cd238f0fb251305008..b52a84185ff5979f8f06fdd34c930e1a8e4b86a7 100644 (file)
@@ -1098,6 +1098,11 @@ static ssize_t set_bcast_scope(struct device *dev,
 }
 static DEVICE_ATTR(broadcast_scope, S_IWUSR | S_IRUGO, show_bcast_scope, set_bcast_scope);
 
+int ipoib_add_broadcast_scope_attr(struct net_device *dev)
+{
+       return device_create_file(&dev->dev, &dev_attr_broadcast_scope);
+}
+
 static ssize_t create_child(struct device *dev,
                            struct device_attribute *attr,
                            const char *buf, size_t count)
@@ -1156,6 +1161,11 @@ int ipoib_pkey_scope_in_use(struct net_device *dev, unsigned short pkey, unsigne
        struct ipoib_dev_priv *ppriv, *priv;
 
        ppriv = netdev_priv(dev);
+       if (ppriv->parent) {
+           dev = ppriv->parent;
+           ppriv = netdev_priv(dev);
+       }
+
        /*
         * We check the parent device and then all of the child interfaces to make sure
         * the Pkey and scope don't match.
@@ -1248,7 +1258,7 @@ static struct net_device *ipoib_add_port(const char *format,
                goto sysfs_failed;
        if (device_create_file(&priv->dev->dev, &dev_attr_delete_child))
                goto sysfs_failed;
-       if (device_create_file(&priv->dev->dev, &dev_attr_broadcast_scope))
+       if (ipoib_add_broadcast_scope_attr(priv->dev))
                goto sysfs_failed;
 
        return priv->dev;
index 280556f22ada3f4247a917008dd81deec5e26571..317a79d59ce1220355b07155d318259389866b53 100644 (file)
@@ -116,6 +116,8 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey,
 
        if (device_create_file(&priv->dev->dev, &dev_attr_parent))
                goto sysfs_failed;
+       if (ipoib_add_broadcast_scope_attr(priv->dev))
+               goto sysfs_failed;
 
        list_add_tail(&priv->list, &ppriv->child_intfs);