]> err.no Git - linux-2.6/commitdiff
[IB] uverbs: Add device-specific ABI version attribute
authorRoland Dreier <rolandd@cisco.com>
Thu, 29 Sep 2005 21:17:48 +0000 (14:17 -0700)
committerRoland Dreier <rolandd@cisco.com>
Mon, 17 Oct 2005 22:20:26 +0000 (15:20 -0700)
Add abi_version attribute to uverbs class devices to allow for
ABI versioning of device-specific interfaces.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/core/uverbs_main.c
drivers/infiniband/hw/mthca/mthca_provider.c
drivers/infiniband/hw/mthca/mthca_user.h
include/rdma/ib_verbs.h

index e7058fbc607dab0b685869cba37f39bf33060e06..c84cc28b60ee4bfc43307a5dd8c24f0088aad01e 100644 (file)
@@ -598,6 +598,15 @@ static ssize_t show_ibdev(struct class_device *class_dev, char *buf)
 }
 static CLASS_DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL);
 
+static ssize_t show_dev_abi_version(struct class_device *class_dev, char *buf)
+{
+       struct ib_uverbs_device *dev =
+               container_of(class_dev, struct ib_uverbs_device, class_dev);
+
+       return sprintf(buf, "%d\n", dev->ib_dev->uverbs_abi_ver);
+}
+static CLASS_DEVICE_ATTR(abi_version, S_IRUGO, show_dev_abi_version, NULL);
+
 static void ib_uverbs_release_class_dev(struct class_device *class_dev)
 {
        struct ib_uverbs_device *dev =
@@ -662,6 +671,8 @@ static void ib_uverbs_add_one(struct ib_device *device)
 
        if (class_device_create_file(&uverbs_dev->class_dev, &class_device_attr_ibdev))
                goto err_class;
+       if (class_device_create_file(&uverbs_dev->class_dev, &class_device_attr_abi_version))
+               goto err_class;
 
        ib_set_client_data(device, &uverbs_client, uverbs_dev);
 
index 141509dced7ebf2a6f808578e46767526b554ba1..939b09dcfe096beadb914160763c2799a2f3bd5a 100644 (file)
@@ -1060,6 +1060,7 @@ int mthca_register_device(struct mthca_dev *dev)
        strlcpy(dev->ib_dev.name, "mthca%d", IB_DEVICE_NAME_MAX);
        dev->ib_dev.owner                = THIS_MODULE;
 
+       dev->ib_dev.uverbs_abi_ver       = MTHCA_UVERBS_ABI_VERSION;
        dev->ib_dev.node_type            = IB_NODE_CA;
        dev->ib_dev.phys_port_cnt        = dev->limits.num_ports;
        dev->ib_dev.dma_device           = &dev->pdev->dev;
index 41613ec8a04e63c92fdfdbfe5d82e897c63c6a8b..bb015c6494c4e0f37d1bf40f963c3172ca3bac49 100644 (file)
 
 #include <linux/types.h>
 
+/*
+ * Increment this value if any changes that break userspace ABI
+ * compatibility are made.
+ */
+#define MTHCA_UVERBS_ABI_VERSION       1
+
 /*
  * Make sure that all structs defined in this file remain laid out so
  * that they pack the same way on 32-bit and 64-bit architectures (to
index e6f4c9e55df7b21d7ff0ccc6408b346594d314eb..d13f25a7819263871663c522652c4aaa759e1148 100644 (file)
@@ -951,6 +951,8 @@ struct ib_device {
                IB_DEV_UNREGISTERED
        }                            reg_state;
 
+       int                          uverbs_abi_ver;
+
        u8                           node_type;
        u8                           phys_port_cnt;
 };