Commit 65198d6b authored by Sagi Grimberg's avatar Sagi Grimberg Committed by Roland Dreier

IB/iser: Keep IB device attributes under iser_device

For T10-PI offload support, we will need to know the device signature
offload capability upon every connection establishment.

This patch does not change any functionality.
Signed-off-by: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarAlex Tabachnik <alext@mellanox.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent 310b347c
......@@ -260,6 +260,7 @@ struct iscsi_iser_task;
struct iser_device {
struct ib_device *ib_device;
struct ib_pd *pd;
struct ib_device_attr dev_attr;
struct ib_cq *rx_cq[ISER_MAX_CQ];
struct ib_cq *tx_cq[ISER_MAX_CQ];
struct ib_mr *mr;
......
......@@ -71,17 +71,14 @@ static void iser_event_handler(struct ib_event_handler *handler,
*/
static int iser_create_device_ib_res(struct iser_device *device)
{
int i, j;
struct iser_cq_desc *cq_desc;
struct ib_device_attr *dev_attr;
struct ib_device_attr *dev_attr = &device->dev_attr;
int ret, i, j;
dev_attr = kmalloc(sizeof(*dev_attr), GFP_KERNEL);
if (!dev_attr)
return -ENOMEM;
if (ib_query_device(device->ib_device, dev_attr)) {
ret = ib_query_device(device->ib_device, dev_attr);
if (ret) {
pr_warn("Query device failed for %s\n", device->ib_device->name);
goto dev_attr_err;
return ret;
}
/* Assign function handles - based on FMR support */
......@@ -101,7 +98,7 @@ static int iser_create_device_ib_res(struct iser_device *device)
device->iser_unreg_rdma_mem = iser_unreg_mem_fastreg;
} else {
iser_err("IB device does not support FMRs nor FastRegs, can't register memory\n");
goto dev_attr_err;
return -1;
}
device->cqs_used = min(ISER_MAX_CQ, device->ib_device->num_comp_vectors);
......@@ -158,7 +155,6 @@ static int iser_create_device_ib_res(struct iser_device *device)
if (ib_register_event_handler(&device->event_handler))
goto handler_err;
kfree(dev_attr);
return 0;
handler_err:
......@@ -178,8 +174,6 @@ static int iser_create_device_ib_res(struct iser_device *device)
kfree(device->cq_desc);
cq_desc_err:
iser_err("failed to allocate an IB resource\n");
dev_attr_err:
kfree(dev_attr);
return -1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment