aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2005-09-29 17:17:48 -0400
committerRoland Dreier <rolandd@cisco.com>2005-10-17 18:20:26 -0400
commit274c0891637c44ac71f3ac40be91b43c2318883a (patch)
treefc7d9f07ab7e663a8acb771069cb9f1053ca2302 /drivers/infiniband
parenteb9d3cd5ce2828fbb99ed7270089ea152c8f64b3 (diff)
[IB] uverbs: Add device-specific ABI version attribute
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>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/uverbs_main.c11
-rw-r--r--drivers/infiniband/hw/mthca/mthca_provider.c1
-rw-r--r--drivers/infiniband/hw/mthca/mthca_user.h6
3 files changed, 18 insertions, 0 deletions
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index e7058fbc607d..c84cc28b60ee 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -598,6 +598,15 @@ static ssize_t show_ibdev(struct class_device *class_dev, char *buf)
598} 598}
599static CLASS_DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL); 599static CLASS_DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL);
600 600
601static ssize_t show_dev_abi_version(struct class_device *class_dev, char *buf)
602{
603 struct ib_uverbs_device *dev =
604 container_of(class_dev, struct ib_uverbs_device, class_dev);
605
606 return sprintf(buf, "%d\n", dev->ib_dev->uverbs_abi_ver);
607}
608static CLASS_DEVICE_ATTR(abi_version, S_IRUGO, show_dev_abi_version, NULL);
609
601static void ib_uverbs_release_class_dev(struct class_device *class_dev) 610static void ib_uverbs_release_class_dev(struct class_device *class_dev)
602{ 611{
603 struct ib_uverbs_device *dev = 612 struct ib_uverbs_device *dev =
@@ -662,6 +671,8 @@ static void ib_uverbs_add_one(struct ib_device *device)
662 671
663 if (class_device_create_file(&uverbs_dev->class_dev, &class_device_attr_ibdev)) 672 if (class_device_create_file(&uverbs_dev->class_dev, &class_device_attr_ibdev))
664 goto err_class; 673 goto err_class;
674 if (class_device_create_file(&uverbs_dev->class_dev, &class_device_attr_abi_version))
675 goto err_class;
665 676
666 ib_set_client_data(device, &uverbs_client, uverbs_dev); 677 ib_set_client_data(device, &uverbs_client, uverbs_dev);
667 678
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index 141509dced7e..939b09dcfe09 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -1060,6 +1060,7 @@ int mthca_register_device(struct mthca_dev *dev)
1060 strlcpy(dev->ib_dev.name, "mthca%d", IB_DEVICE_NAME_MAX); 1060 strlcpy(dev->ib_dev.name, "mthca%d", IB_DEVICE_NAME_MAX);
1061 dev->ib_dev.owner = THIS_MODULE; 1061 dev->ib_dev.owner = THIS_MODULE;
1062 1062
1063 dev->ib_dev.uverbs_abi_ver = MTHCA_UVERBS_ABI_VERSION;
1063 dev->ib_dev.node_type = IB_NODE_CA; 1064 dev->ib_dev.node_type = IB_NODE_CA;
1064 dev->ib_dev.phys_port_cnt = dev->limits.num_ports; 1065 dev->ib_dev.phys_port_cnt = dev->limits.num_ports;
1065 dev->ib_dev.dma_device = &dev->pdev->dev; 1066 dev->ib_dev.dma_device = &dev->pdev->dev;
diff --git a/drivers/infiniband/hw/mthca/mthca_user.h b/drivers/infiniband/hw/mthca/mthca_user.h
index 41613ec8a04e..bb015c6494c4 100644
--- a/drivers/infiniband/hw/mthca/mthca_user.h
+++ b/drivers/infiniband/hw/mthca/mthca_user.h
@@ -38,6 +38,12 @@
38#include <linux/types.h> 38#include <linux/types.h>
39 39
40/* 40/*
41 * Increment this value if any changes that break userspace ABI
42 * compatibility are made.
43 */
44#define MTHCA_UVERBS_ABI_VERSION 1
45
46/*
41 * Make sure that all structs defined in this file remain laid out so 47 * Make sure that all structs defined in this file remain laid out so
42 * that they pack the same way on 32-bit and 64-bit architectures (to 48 * that they pack the same way on 32-bit and 64-bit architectures (to
43 * avoid incompatibility between 32-bit userspace and 64-bit kernels). 49 * avoid incompatibility between 32-bit userspace and 64-bit kernels).