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>
This commit is contained in:
Sean Hefty
2006-01-10 07:39:34 -08:00
committed by Roland Dreier
parent 87635b71b5
commit cf311cd49a
6 changed files with 54 additions and 64 deletions

View File

@@ -3163,22 +3163,6 @@ int ib_cm_init_qp_attr(struct ib_cm_id *cm_id,
}
EXPORT_SYMBOL(ib_cm_init_qp_attr);
static __be64 cm_get_ca_guid(struct ib_device *device)
{
struct ib_device_attr *device_attr;
__be64 guid;
int ret;
device_attr = kmalloc(sizeof *device_attr, GFP_KERNEL);
if (!device_attr)
return 0;
ret = ib_query_device(device, device_attr);
guid = ret ? 0 : device_attr->node_guid;
kfree(device_attr);
return guid;
}
static void cm_add_one(struct ib_device *device)
{
struct cm_device *cm_dev;
@@ -3200,9 +3184,7 @@ static void cm_add_one(struct ib_device *device)
return;
cm_dev->device = device;
cm_dev->ca_guid = cm_get_ca_guid(device);
if (!cm_dev->ca_guid)
goto error1;
cm_dev->ca_guid = device->node_guid;
set_bit(IB_MGMT_METHOD_SEND, reg_req.method_mask);
for (i = 1; i <= device->phys_port_cnt; i++) {
@@ -3217,11 +3199,11 @@ static void cm_add_one(struct ib_device *device)
cm_recv_handler,
port);
if (IS_ERR(port->mad_agent))
goto error2;
goto error1;
ret = ib_modify_port(device, i, 0, &port_modify);
if (ret)
goto error3;
goto error2;
}
ib_set_client_data(device, &cm_client, cm_dev);
@@ -3230,9 +3212,9 @@ static void cm_add_one(struct ib_device *device)
write_unlock_irqrestore(&cm.device_lock, flags);
return;
error3:
ib_unregister_mad_agent(port->mad_agent);
error2:
ib_unregister_mad_agent(port->mad_agent);
error1:
port_modify.set_port_cap_mask = 0;
port_modify.clr_port_cap_mask = IB_PORT_CM_SUP;
while (--i) {
@@ -3240,7 +3222,6 @@ error2:
ib_modify_port(device, port->port_num, 0, &port_modify);
ib_unregister_mad_agent(port->mad_agent);
}
error1:
kfree(cm_dev);
}