xprtrdma: Take struct ib_qp_attr and ib_qp_init_attr off the stack
authorChuck Lever <chuck.lever@oracle.com>
Wed, 21 Jan 2015 16:03:35 +0000 (11:03 -0500)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Fri, 30 Jan 2015 15:47:48 +0000 (10:47 -0500)
Reduce stack footprint of the connection upcall handler function.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xprtrdma/verbs.c
net/sunrpc/xprtrdma/xprt_rdma.h

index 123bb04dd823d9851292d259f022a8ac5ce8a534..958b372cb919ca57bc07fcec88644f1798eb4dc4 100644 (file)
@@ -425,8 +425,8 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event)
 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
        struct sockaddr_in *addr = (struct sockaddr_in *) &ep->rep_remote_addr;
 #endif
-       struct ib_qp_attr attr;
-       struct ib_qp_init_attr iattr;
+       struct ib_qp_attr *attr = &ia->ri_qp_attr;
+       struct ib_qp_init_attr *iattr = &ia->ri_qp_init_attr;
        int connstate = 0;
 
        switch (event->event) {
@@ -449,12 +449,13 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event)
                break;
        case RDMA_CM_EVENT_ESTABLISHED:
                connstate = 1;
-               ib_query_qp(ia->ri_id->qp, &attr,
-                       IB_QP_MAX_QP_RD_ATOMIC | IB_QP_MAX_DEST_RD_ATOMIC,
-                       &iattr);
+               ib_query_qp(ia->ri_id->qp, attr,
+                           IB_QP_MAX_QP_RD_ATOMIC | IB_QP_MAX_DEST_RD_ATOMIC,
+                           iattr);
                dprintk("RPC:       %s: %d responder resources"
                        " (%d initiator)\n",
-                       __func__, attr.max_dest_rd_atomic, attr.max_rd_atomic);
+                       __func__, attr->max_dest_rd_atomic,
+                       attr->max_rd_atomic);
                goto connected;
        case RDMA_CM_EVENT_CONNECT_ERROR:
                connstate = -ENOTCONN;
@@ -487,7 +488,7 @@ connected:
 
 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
        if (connstate == 1) {
-               int ird = attr.max_dest_rd_atomic;
+               int ird = attr->max_dest_rd_atomic;
                int tird = ep->rep_remote_cma.responder_resources;
                printk(KERN_INFO "rpcrdma: connection to %pI4:%u "
                        "on %s, memreg %d slots %d ird %d%s\n",
index ec596cebc96623c2e6660f632792ef00d587a69a..2b4e7787734d510511a40e6637513dce9b90f1de 100644 (file)
@@ -71,6 +71,8 @@ struct rpcrdma_ia {
        enum rpcrdma_memreg     ri_memreg_strategy;
        unsigned int            ri_max_frmr_depth;
        struct ib_device_attr   ri_devattr;
+       struct ib_qp_attr       ri_qp_attr;
+       struct ib_qp_init_attr  ri_qp_init_attr;
 };
 
 /*