return NULL;
}
+static unsigned int kiblnd_send_wrs(struct kib_conn *conn)
+{
+ /*
+ * One WR for the LNet message
+ * And ibc_max_frags for the transfer WRs
+ */
+ unsigned int ret = 1 + conn->ibc_max_frags;
+
+ /* account for a maximum of ibc_queue_depth in-flight transfers */
+ ret *= conn->ibc_queue_depth;
+ return ret;
+}
+
kib_conn_t *
kiblnd_create_conn(kib_peer_ni_t *peer_ni, struct rdma_cm_id *cmid,
int state, int version)
init_qp_attr->event_handler = kiblnd_qp_event;
init_qp_attr->qp_context = conn;
- init_qp_attr->cap.max_send_wr = IBLND_SEND_WRS(conn);
- init_qp_attr->cap.max_recv_wr = IBLND_RECV_WRS(conn);
init_qp_attr->cap.max_send_sge = *kiblnd_tunables.kib_wrq_sge;
init_qp_attr->cap.max_recv_sge = 1;
init_qp_attr->sq_sig_type = IB_SIGNAL_REQ_WR;
conn->ibc_sched = sched;
do {
+ init_qp_attr->cap.max_send_wr = kiblnd_send_wrs(conn);
+ init_qp_attr->cap.max_recv_wr = IBLND_RECV_WRS(conn);
+
rc = rdma_create_qp(cmid, conn->ibc_hdev->ibh_pd, init_qp_attr);
- if (!rc || init_qp_attr->cap.max_send_wr < 16)
+ if (!rc || conn->ibc_queue_depth < 2)
break;
- init_qp_attr->cap.max_send_wr -= init_qp_attr->cap.max_send_wr / 4;
+ conn->ibc_queue_depth--;
} while (rc);
if (rc) {
goto failed_2;
}
- if (init_qp_attr->cap.max_send_wr != IBLND_SEND_WRS(conn))
- CDEBUG(D_NET, "original send wr %d, created with %d\n",
- IBLND_SEND_WRS(conn), init_qp_attr->cap.max_send_wr);
+ if (conn->ibc_queue_depth != peer_ni->ibp_queue_depth)
+ CWARN("peer %s - queue depth reduced from %u to %u"
+ " to allow for qp creation\n",
+ libcfs_nid2str(peer_ni->ibp_nid),
+ peer_ni->ibp_queue_depth,
+ conn->ibc_queue_depth);
LIBCFS_FREE(init_qp_attr, sizeof(*init_qp_attr));