Whamcloud - gitweb
LU-7124 o2iblnd: limit cap.max_send_wr for MLX5 47/18347/9
authorDmitry Eremin <dmitry.eremin@intel.com>
Mon, 8 Feb 2016 12:54:06 +0000 (15:54 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 14 Mar 2016 02:42:08 +0000 (02:42 +0000)
Decrease cap.max_send_wr until it is accepted by rdma_create_qp()

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Change-Id: Ib76f07d997ea579f86fca467329ad357ed26b36f
Reviewed-on: http://review.whamcloud.com/18347
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Olaf Weber <olaf@sgi.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/klnds/o2iblnd/o2iblnd.c

index 957dc0e..4d25dd4 100644 (file)
@@ -848,24 +848,34 @@ kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid,
 
        conn->ibc_sched = sched;
 
-        rc = rdma_create_qp(cmid, conn->ibc_hdev->ibh_pd, init_qp_attr);
-        if (rc != 0) {
-                CERROR("Can't create QP: %d, send_wr: %d, recv_wr: %d\n",
-                       rc, init_qp_attr->cap.max_send_wr,
-                       init_qp_attr->cap.max_recv_wr);
-                goto failed_2;
-        }
+       do {
+               rc = rdma_create_qp(cmid, conn->ibc_hdev->ibh_pd, init_qp_attr);
+               if (!rc || init_qp_attr->cap.max_send_wr < 16)
+                       break;
 
-        LIBCFS_FREE(init_qp_attr, sizeof(*init_qp_attr));
+               init_qp_attr->cap.max_send_wr -= init_qp_attr->cap.max_send_wr / 4;
+       } while (rc);
+
+       if (rc) {
+               CERROR("Can't create QP: %d, send_wr: %d, recv_wr: %d\n",
+                       rc, init_qp_attr->cap.max_send_wr,
+                       init_qp_attr->cap.max_recv_wr);
+               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);
+
+       LIBCFS_FREE(init_qp_attr, sizeof(*init_qp_attr));
 
-        /* 1 ref for caller and each rxmsg */
+       /* 1 ref for caller and each rxmsg */
        atomic_set(&conn->ibc_refcount, 1 + IBLND_RX_MSGS(conn));
        conn->ibc_nrx = IBLND_RX_MSGS(conn);
 
-        /* post receives */
+       /* post receives */
        for (i = 0; i < IBLND_RX_MSGS(conn); i++) {
-               rc = kiblnd_post_rx(&conn->ibc_rxs[i],
-                                   IBLND_POSTRX_NO_CREDIT);
+               rc = kiblnd_post_rx(&conn->ibc_rxs[i], IBLND_POSTRX_NO_CREDIT);
                if (rc != 0) {
                        CERROR("Can't post rxmsg: %d\n", rc);