aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp
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/ulp
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/ulp')
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index dd488d3cffa..31207e66414 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1516,8 +1516,7 @@ static ssize_t show_port(struct class_device *class_dev, char *buf)
1516 1516
1517static CLASS_DEVICE_ATTR(port, S_IRUGO, show_port, NULL); 1517static CLASS_DEVICE_ATTR(port, S_IRUGO, show_port, NULL);
1518 1518
1519static struct srp_host *srp_add_port(struct ib_device *device, 1519static struct srp_host *srp_add_port(struct ib_device *device, u8 port)
1520 __be64 node_guid, u8 port)
1521{ 1520{
1522 struct srp_host *host; 1521 struct srp_host *host;
1523 1522
@@ -1532,7 +1531,7 @@ static struct srp_host *srp_add_port(struct ib_device *device,
1532 host->port = port; 1531 host->port = port;
1533 1532
1534 host->initiator_port_id[7] = port; 1533 host->initiator_port_id[7] = port;
1535 memcpy(host->initiator_port_id + 8, &node_guid, 8); 1534 memcpy(host->initiator_port_id + 8, &device->node_guid, 8);
1536 1535
1537 host->pd = ib_alloc_pd(device); 1536 host->pd = ib_alloc_pd(device);
1538 if (IS_ERR(host->pd)) 1537 if (IS_ERR(host->pd))
@@ -1580,22 +1579,11 @@ static void srp_add_one(struct ib_device *device)
1580{ 1579{
1581 struct list_head *dev_list; 1580 struct list_head *dev_list;
1582 struct srp_host *host; 1581 struct srp_host *host;
1583 struct ib_device_attr *dev_attr;
1584 int s, e, p; 1582 int s, e, p;
1585 1583
1586 dev_attr = kmalloc(sizeof *dev_attr, GFP_KERNEL);
1587 if (!dev_attr)
1588 return;
1589
1590 if (ib_query_device(device, dev_attr)) {
1591 printk(KERN_WARNING PFX "Couldn't query node GUID for %s.\n",
1592 device->name);
1593 goto out;
1594 }
1595
1596 dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL); 1584 dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL);
1597 if (!dev_list) 1585 if (!dev_list)
1598 goto out; 1586 return;
1599 1587
1600 INIT_LIST_HEAD(dev_list); 1588 INIT_LIST_HEAD(dev_list);
1601 1589
@@ -1608,15 +1596,12 @@ static void srp_add_one(struct ib_device *device)
1608 } 1596 }
1609 1597
1610 for (p = s; p <= e; ++p) { 1598 for (p = s; p <= e; ++p) {
1611 host = srp_add_port(device, dev_attr->node_guid, p); 1599 host = srp_add_port(device, p);
1612 if (host) 1600 if (host)
1613 list_add_tail(&host->list, dev_list); 1601 list_add_tail(&host->list, dev_list);
1614 } 1602 }
1615 1603
1616 ib_set_client_data(device, &srp_client, dev_list); 1604 ib_set_client_data(device, &srp_client, dev_list);
1617
1618out:
1619 kfree(dev_attr);
1620} 1605}
1621 1606
1622static void srp_remove_one(struct ib_device *device) 1607static void srp_remove_one(struct ib_device *device)