isert: Do not fail with cards that support small number of WR per QP

This fixes an issue with ConnectIB

Reported-by: Eric Millbrandt <eric.millbrandt@cacheio.com>
Signed-off-by: Yan Burman <yanb@mellanox.com>

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/iser@5899 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Yan Burman
2014-11-30 08:17:18 +00:00
parent 083634586a
commit 03548dbc24
2 changed files with 21 additions and 7 deletions

View File

@@ -101,6 +101,8 @@ struct isert_wr {
#define ISER_SQ_SIZE 128
#define ISER_MAX_WCE 2048
#define ISER_MIN_SQ_SIZE 16
struct isert_cmnd {
struct iscsi_cmnd iscsi ____cacheline_aligned;

View File

@@ -977,6 +977,7 @@ static int isert_conn_qp_create(struct isert_connection *isert_conn)
struct ib_qp_init_attr qp_attr;
int err;
int cq_idx;
int max_wr = ISER_MAX_WCE;
TRACE_ENTRY();
@@ -988,8 +989,6 @@ static int isert_conn_qp_create(struct isert_connection *isert_conn)
qp_attr.qp_context = isert_conn;
qp_attr.send_cq = isert_dev->cq_desc[cq_idx].cq;
qp_attr.recv_cq = isert_dev->cq_desc[cq_idx].cq;
qp_attr.cap.max_send_wr = ISER_MAX_WCE;
qp_attr.cap.max_recv_wr = ISER_MAX_WCE;
isert_conn->cq_desc = &isert_dev->cq_desc[cq_idx];
@@ -1013,11 +1012,24 @@ static int isert_conn_qp_create(struct isert_connection *isert_conn)
qp_attr.sq_sig_type = IB_SIGNAL_REQ_WR;
qp_attr.qp_type = IB_QPT_RC;
err = rdma_create_qp(cm_id, isert_dev->pd, &qp_attr);
if (unlikely(err)) {
pr_err("Failed to create qp, err:%d\n", err);
goto fail_create_qp;
}
do {
if (max_wr < ISER_MIN_SQ_SIZE) {
pr_err("Failed to create qp, not enough memory\n");
goto fail_create_qp;
}
qp_attr.cap.max_send_wr = max_wr;
qp_attr.cap.max_recv_wr = max_wr;
err = rdma_create_qp(cm_id, isert_dev->pd, &qp_attr);
if (err && err != -ENOMEM) {
pr_err("Failed to create qp, err:%d\n", err);
goto fail_create_qp;
}
max_wr /= 2;
} while (err == -ENOMEM);
isert_conn->qp = cm_id->qp;
pr_info("iser created cm_id:%p qp:0x%X\n", cm_id, cm_id->qp->qp_num);