aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw
diff options
context:
space:
mode:
authorSean Hefty <sean.hefty@intel.com>2006-01-10 10:39:34 -0500
committerRoland Dreier <rolandd@cisco.com>2006-01-10 10:39:34 -0500
commitcf311cd49a78f1e431787068cc31d29d06a415e6 (patch)
tree369bb01420f5120df73c12903eb9e7783b8489ad /drivers/infiniband/hw
parent87635b71b544563f29050a9cecaa12b5d2a3e34a (diff)
IB: Add node_guid to struct ib_device
Add a node_guid field to struct ib_device. It is the responsibility of the low-level driver to initialize this field before registering a device with the midlayer. Convert everyone to looking at this field instead of calling ib_query_device() when all they want is the node GUID, and remove the node_guid field from struct ib_device_attr. Signed-off-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_provider.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index 488757766a5d..db35690c91de 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -33,7 +33,7 @@
33 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34 * SOFTWARE. 34 * SOFTWARE.
35 * 35 *
36 * $Id: mthca_provider.c 1397 2004-12-28 05:09:00Z roland $ 36 * $Id: mthca_provider.c 4859 2006-01-09 21:55:10Z roland $
37 */ 37 */
38 38
39#include <rdma/ib_smi.h> 39#include <rdma/ib_smi.h>
@@ -91,7 +91,6 @@ static int mthca_query_device(struct ib_device *ibdev,
91 props->vendor_part_id = be16_to_cpup((__be16 *) (out_mad->data + 30)); 91 props->vendor_part_id = be16_to_cpup((__be16 *) (out_mad->data + 30));
92 props->hw_ver = be32_to_cpup((__be32 *) (out_mad->data + 32)); 92 props->hw_ver = be32_to_cpup((__be32 *) (out_mad->data + 32));
93 memcpy(&props->sys_image_guid, out_mad->data + 4, 8); 93 memcpy(&props->sys_image_guid, out_mad->data + 4, 8);
94 memcpy(&props->node_guid, out_mad->data + 12, 8);
95 94
96 props->max_mr_size = ~0ull; 95 props->max_mr_size = ~0ull;
97 props->page_size_cap = mdev->limits.page_size_cap; 96 props->page_size_cap = mdev->limits.page_size_cap;
@@ -1054,11 +1053,48 @@ static struct class_device_attribute *mthca_class_attributes[] = {
1054 &class_device_attr_board_id 1053 &class_device_attr_board_id
1055}; 1054};
1056 1055
1056static int mthca_init_node_data(struct mthca_dev *dev)
1057{
1058 struct ib_smp *in_mad = NULL;
1059 struct ib_smp *out_mad = NULL;
1060 int err = -ENOMEM;
1061 u8 status;
1062
1063 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
1064 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
1065 if (!in_mad || !out_mad)
1066 goto out;
1067
1068 init_query_mad(in_mad);
1069 in_mad->attr_id = IB_SMP_ATTR_NODE_INFO;
1070
1071 err = mthca_MAD_IFC(dev, 1, 1,
1072 1, NULL, NULL, in_mad, out_mad,
1073 &status);
1074 if (err)
1075 goto out;
1076 if (status) {
1077 err = -EINVAL;
1078 goto out;
1079 }
1080
1081 memcpy(&dev->ib_dev.node_guid, out_mad->data + 12, 8);
1082
1083out:
1084 kfree(in_mad);
1085 kfree(out_mad);
1086 return err;
1087}
1088
1057int mthca_register_device(struct mthca_dev *dev) 1089int mthca_register_device(struct mthca_dev *dev)
1058{ 1090{
1059 int ret; 1091 int ret;
1060 int i; 1092 int i;
1061 1093
1094 ret = mthca_init_node_data(dev);
1095 if (ret)
1096 return ret;
1097
1062 strlcpy(dev->ib_dev.name, "mthca%d", IB_DEVICE_NAME_MAX); 1098 strlcpy(dev->ib_dev.name, "mthca%d", IB_DEVICE_NAME_MAX);
1063 dev->ib_dev.owner = THIS_MODULE; 1099 dev->ib_dev.owner = THIS_MODULE;
1064 1100