aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Moore <Chris.Moore@Emulex.Com>2015-01-30 22:17:20 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-02-05 22:35:40 -0800
commitc50ad63aabedaa98bc9b4d57e38fa8e2d22938a3 (patch)
treedba0adf4a5d66010457f1b1dd7cefd41e84173ef
parent85be16bad779a187bedc4292f2adc54863b4375b (diff)
downloadlinux-linaro-stable-c50ad63aabedaa98bc9b4d57e38fa8e2d22938a3.tar.gz
IB/isert: Adjust CQ size to HW limits
commit b1a5ad006b34ded9dc7ec64988deba1b3ecad367 upstream. isert has an issue of trying to create a CQ with more CQEs than are supported by the hardware, that currently results in failures during isert_device creation during first session login. This is the isert version of the patch that Minh Tran submitted for iser, and is simple a workaround required to function with existing ocrdma hardware. Signed-off-by: Chris Moore <chris.moore@emulex.com> Reviewied-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/infiniband/ulp/isert/ib_isert.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 5d4a4583d2df..42f5eddd0ece 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -212,6 +212,13 @@ isert_create_device_ib_res(struct isert_device *device)
struct ib_device *ib_dev = device->ib_device;
struct isert_cq_desc *cq_desc;
int ret = 0, i, j;
+ int max_rx_cqe, max_tx_cqe;
+ struct ib_device_attr dev_attr;
+
+ memset(&dev_attr, 0, sizeof(struct ib_device_attr));
+ ret = isert_query_device(device->ib_device, &dev_attr);
+ if (ret)
+ return ret;
device->cqs_used = min_t(int, num_online_cpus(),
device->ib_device->num_comp_vectors);
@@ -234,6 +241,9 @@ isert_create_device_ib_res(struct isert_device *device)
goto out_cq_desc;
}
+ max_rx_cqe = min(ISER_MAX_RX_CQ_LEN, dev_attr.max_cqe);
+ max_tx_cqe = min(ISER_MAX_TX_CQ_LEN, dev_attr.max_cqe);
+
for (i = 0; i < device->cqs_used; i++) {
cq_desc[i].device = device;
cq_desc[i].cq_index = i;
@@ -242,7 +252,7 @@ isert_create_device_ib_res(struct isert_device *device)
isert_cq_rx_callback,
isert_cq_event_callback,
(void *)&cq_desc[i],
- ISER_MAX_RX_CQ_LEN, i);
+ max_rx_cqe, i);
if (IS_ERR(device->dev_rx_cq[i])) {
ret = PTR_ERR(device->dev_rx_cq[i]);
device->dev_rx_cq[i] = NULL;
@@ -253,7 +263,7 @@ isert_create_device_ib_res(struct isert_device *device)
isert_cq_tx_callback,
isert_cq_event_callback,
(void *)&cq_desc[i],
- ISER_MAX_TX_CQ_LEN, i);
+ max_tx_cqe, i);
if (IS_ERR(device->dev_tx_cq[i])) {
ret = PTR_ERR(device->dev_tx_cq[i]);
device->dev_tx_cq[i] = NULL;