Merge tag 'nfs-for-4.2-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
[firefly-linux-kernel-4.4.55.git] / net / sunrpc / xprtrdma / verbs.c
index 234083560d0e2c5817d47775c17eceebdef23117..891c4ede2c20ea8d8c6bc79ee080f353d4df13d7 100644 (file)
@@ -99,32 +99,6 @@ rpcrdma_run_tasklet(unsigned long data)
 
 static DECLARE_TASKLET(rpcrdma_tasklet_g, rpcrdma_run_tasklet, 0UL);
 
-static const char * const async_event[] = {
-       "CQ error",
-       "QP fatal error",
-       "QP request error",
-       "QP access error",
-       "communication established",
-       "send queue drained",
-       "path migration successful",
-       "path mig error",
-       "device fatal error",
-       "port active",
-       "port error",
-       "LID change",
-       "P_key change",
-       "SM change",
-       "SRQ error",
-       "SRQ limit reached",
-       "last WQE reached",
-       "client reregister",
-       "GID change",
-};
-
-#define ASYNC_MSG(status)                                      \
-       ((status) < ARRAY_SIZE(async_event) ?                   \
-               async_event[(status)] : "unknown async error")
-
 static void
 rpcrdma_schedule_tasklet(struct list_head *sched_list)
 {
@@ -142,7 +116,7 @@ rpcrdma_qp_async_error_upcall(struct ib_event *event, void *context)
        struct rpcrdma_ep *ep = context;
 
        pr_err("RPC:       %s: %s on device %s ep %p\n",
-              __func__, ASYNC_MSG(event->event),
+              __func__, ib_event_msg(event->event),
                event->device->name, context);
        if (ep->rep_connected == 1) {
                ep->rep_connected = -EIO;
@@ -157,7 +131,7 @@ rpcrdma_cq_async_error_upcall(struct ib_event *event, void *context)
        struct rpcrdma_ep *ep = context;
 
        pr_err("RPC:       %s: %s on device %s ep %p\n",
-              __func__, ASYNC_MSG(event->event),
+              __func__, ib_event_msg(event->event),
                event->device->name, context);
        if (ep->rep_connected == 1) {
                ep->rep_connected = -EIO;
@@ -166,35 +140,6 @@ rpcrdma_cq_async_error_upcall(struct ib_event *event, void *context)
        }
 }
 
-static const char * const wc_status[] = {
-       "success",
-       "local length error",
-       "local QP operation error",
-       "local EE context operation error",
-       "local protection error",
-       "WR flushed",
-       "memory management operation error",
-       "bad response error",
-       "local access error",
-       "remote invalid request error",
-       "remote access error",
-       "remote operation error",
-       "transport retry counter exceeded",
-       "RNR retry counter exceeded",
-       "local RDD violation error",
-       "remove invalid RD request",
-       "operation aborted",
-       "invalid EE context number",
-       "invalid EE context state",
-       "fatal error",
-       "response timeout error",
-       "general error",
-};
-
-#define COMPLETION_MSG(status)                                 \
-       ((status) < ARRAY_SIZE(wc_status) ?                     \
-               wc_status[(status)] : "unexpected completion error")
-
 static void
 rpcrdma_sendcq_process_wc(struct ib_wc *wc)
 {
@@ -203,7 +148,7 @@ rpcrdma_sendcq_process_wc(struct ib_wc *wc)
                if (wc->status != IB_WC_SUCCESS &&
                    wc->status != IB_WC_WR_FLUSH_ERR)
                        pr_err("RPC:       %s: SEND: %s\n",
-                              __func__, COMPLETION_MSG(wc->status));
+                              __func__, ib_wc_status_msg(wc->status));
        } else {
                struct rpcrdma_mw *r;
 
@@ -296,7 +241,7 @@ out_schedule:
 out_fail:
        if (wc->status != IB_WC_WR_FLUSH_ERR)
                pr_err("RPC:       %s: rep %p: %s\n",
-                      __func__, rep, COMPLETION_MSG(wc->status));
+                      __func__, rep, ib_wc_status_msg(wc->status));
        rep->rr_len = ~0U;
        goto out_schedule;
 }
@@ -380,31 +325,6 @@ rpcrdma_flush_cqs(struct rpcrdma_ep *ep)
                rpcrdma_sendcq_process_wc(&wc);
 }
 
-#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
-static const char * const conn[] = {
-       "address resolved",
-       "address error",
-       "route resolved",
-       "route error",
-       "connect request",
-       "connect response",
-       "connect error",
-       "unreachable",
-       "rejected",
-       "established",
-       "disconnected",
-       "device removal",
-       "multicast join",
-       "multicast error",
-       "address change",
-       "timewait exit",
-};
-
-#define CONNECTION_MSG(status)                                         \
-       ((status) < ARRAY_SIZE(conn) ?                                  \
-               conn[(status)] : "unrecognized connection error")
-#endif
-
 static int
 rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event)
 {
@@ -470,7 +390,7 @@ connected:
        default:
                dprintk("RPC:       %s: %pIS:%u (ep 0x%p): %s\n",
                        __func__, sap, rpc_get_port(sap), ep,
-                       CONNECTION_MSG(event->event));
+                       rdma_event_msg(event->event));
                break;
        }
 
@@ -716,6 +636,7 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
 {
        struct ib_device_attr *devattr = &ia->ri_devattr;
        struct ib_cq *sendcq, *recvcq;
+       struct ib_cq_init_attr cq_attr = {};
        int rc, err;
 
        /* check provider's send/recv wr limits */
@@ -763,9 +684,9 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
        init_waitqueue_head(&ep->rep_connect_wait);
        INIT_DELAYED_WORK(&ep->rep_connect_worker, rpcrdma_connect_worker);
 
+       cq_attr.cqe = ep->rep_attr.cap.max_send_wr + 1;
        sendcq = ib_create_cq(ia->ri_device, rpcrdma_sendcq_upcall,
-                             rpcrdma_cq_async_error_upcall, ep,
-                             ep->rep_attr.cap.max_send_wr + 1, 0);
+                             rpcrdma_cq_async_error_upcall, ep, &cq_attr);
        if (IS_ERR(sendcq)) {
                rc = PTR_ERR(sendcq);
                dprintk("RPC:       %s: failed to create send CQ: %i\n",
@@ -780,9 +701,9 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
                goto out2;
        }
 
+       cq_attr.cqe = ep->rep_attr.cap.max_recv_wr + 1;
        recvcq = ib_create_cq(ia->ri_device, rpcrdma_recvcq_upcall,
-                             rpcrdma_cq_async_error_upcall, ep,
-                             ep->rep_attr.cap.max_recv_wr + 1, 0);
+                             rpcrdma_cq_async_error_upcall, ep, &cq_attr);
        if (IS_ERR(recvcq)) {
                rc = PTR_ERR(recvcq);
                dprintk("RPC:       %s: failed to create recv CQ: %i\n",