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:
committed by
Roland Dreier
parent
87635b71b5
commit
cf311cd49a
@ -1516,8 +1516,7 @@ static ssize_t show_port(struct class_device *class_dev, char *buf)
|
||||
|
||||
static CLASS_DEVICE_ATTR(port, S_IRUGO, show_port, NULL);
|
||||
|
||||
static struct srp_host *srp_add_port(struct ib_device *device,
|
||||
__be64 node_guid, u8 port)
|
||||
static struct srp_host *srp_add_port(struct ib_device *device, u8 port)
|
||||
{
|
||||
struct srp_host *host;
|
||||
|
||||
@ -1532,7 +1531,7 @@ static struct srp_host *srp_add_port(struct ib_device *device,
|
||||
host->port = port;
|
||||
|
||||
host->initiator_port_id[7] = port;
|
||||
memcpy(host->initiator_port_id + 8, &node_guid, 8);
|
||||
memcpy(host->initiator_port_id + 8, &device->node_guid, 8);
|
||||
|
||||
host->pd = ib_alloc_pd(device);
|
||||
if (IS_ERR(host->pd))
|
||||
@ -1580,22 +1579,11 @@ static void srp_add_one(struct ib_device *device)
|
||||
{
|
||||
struct list_head *dev_list;
|
||||
struct srp_host *host;
|
||||
struct ib_device_attr *dev_attr;
|
||||
int s, e, p;
|
||||
|
||||
dev_attr = kmalloc(sizeof *dev_attr, GFP_KERNEL);
|
||||
if (!dev_attr)
|
||||
return;
|
||||
|
||||
if (ib_query_device(device, dev_attr)) {
|
||||
printk(KERN_WARNING PFX "Couldn't query node GUID for %s.\n",
|
||||
device->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL);
|
||||
if (!dev_list)
|
||||
goto out;
|
||||
return;
|
||||
|
||||
INIT_LIST_HEAD(dev_list);
|
||||
|
||||
@ -1608,15 +1596,12 @@ static void srp_add_one(struct ib_device *device)
|
||||
}
|
||||
|
||||
for (p = s; p <= e; ++p) {
|
||||
host = srp_add_port(device, dev_attr->node_guid, p);
|
||||
host = srp_add_port(device, p);
|
||||
if (host)
|
||||
list_add_tail(&host->list, dev_list);
|
||||
}
|
||||
|
||||
ib_set_client_data(device, &srp_client, dev_list);
|
||||
|
||||
out:
|
||||
kfree(dev_attr);
|
||||
}
|
||||
|
||||
static void srp_remove_one(struct ib_device *device)
|
||||
|
Reference in New Issue
Block a user