]> git.baikalelectronics.ru Git - kernel.git/commitdiff
xprtrdma: Eliminate ri_max_send_sges
authorChuck Lever <chuck.lever@oracle.com>
Fri, 3 Jan 2020 16:56:27 +0000 (11:56 -0500)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Wed, 15 Jan 2020 15:54:32 +0000 (10:54 -0500)
Clean-up. The max_send_sge value also happens to be stored in
ep->rep_attr. Let's keep just a single copy.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xprtrdma/frwr_ops.c
net/sunrpc/xprtrdma/rpc_rdma.c
net/sunrpc/xprtrdma/verbs.c
net/sunrpc/xprtrdma/xprt_rdma.h

index 523722be6a16ad22deb908c110a625fab6a29fbd..859c301d9d30351f2af8dbedbfa5c3c6f4006610 100644 (file)
@@ -190,6 +190,16 @@ int frwr_open(struct rpcrdma_ia *ia, struct rpcrdma_ep *ep)
 {
        struct ib_device_attr *attrs = &ia->ri_id->device->attrs;
        int max_qp_wr, depth, delta;
+       unsigned int max_sge;
+
+       max_sge = min_t(unsigned int, attrs->max_send_sge,
+                       RPCRDMA_MAX_SEND_SGES);
+       if (max_sge < RPCRDMA_MIN_SEND_SGES) {
+               pr_err("rpcrdma: HCA provides only %u send SGEs\n", max_sge);
+               return -ENOMEM;
+       }
+       ep->rep_attr.cap.max_send_sge = max_sge;
+       ep->rep_attr.cap.max_recv_sge = 1;
 
        ia->ri_mrtype = IB_MR_TYPE_MEM_REG;
        if (attrs->device_cap_flags & IB_DEVICE_SG_GAPS_REG)
index aec3beb93b253477d2e0b5098ca46fffcf176f5f..af917228d2457eb8f54e5fe4f8ad8d19476ea608 100644 (file)
@@ -145,7 +145,7 @@ static bool rpcrdma_args_inline(struct rpcrdma_xprt *r_xprt,
                        remaining -= min_t(unsigned int,
                                           PAGE_SIZE - offset, remaining);
                        offset = 0;
-                       if (++count > r_xprt->rx_ia.ri_max_send_sges)
+                       if (++count > r_xprt->rx_ep.rep_attr.cap.max_send_sge)
                                return false;
                }
        }
index fda3889993cbbef28c909cbd334d2820ce0ff3a4..945603662419e0b33030f336630f214ad35da71a 100644 (file)
@@ -470,21 +470,12 @@ int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt)
        struct rpcrdma_ia *ia = &r_xprt->rx_ia;
        struct rpcrdma_connect_private *pmsg = &ep->rep_cm_private;
        struct ib_cq *sendcq, *recvcq;
-       unsigned int max_sge;
        int rc;
 
        ep->rep_max_requests = xprt_rdma_slot_table_entries;
        ep->rep_inline_send = xprt_rdma_max_inline_write;
        ep->rep_inline_recv = xprt_rdma_max_inline_read;
 
-       max_sge = min_t(unsigned int, ia->ri_id->device->attrs.max_send_sge,
-                       RPCRDMA_MAX_SEND_SGES);
-       if (max_sge < RPCRDMA_MIN_SEND_SGES) {
-               pr_warn("rpcrdma: HCA provides only %d send SGEs\n", max_sge);
-               return -ENOMEM;
-       }
-       ia->ri_max_send_sges = max_sge;
-
        rc = frwr_open(ia, ep);
        if (rc)
                return rc;
@@ -492,8 +483,6 @@ int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt)
        ep->rep_attr.event_handler = rpcrdma_qp_event_handler;
        ep->rep_attr.qp_context = ep;
        ep->rep_attr.srq = NULL;
-       ep->rep_attr.cap.max_send_sge = max_sge;
-       ep->rep_attr.cap.max_recv_sge = 1;
        ep->rep_attr.cap.max_inline_data = 0;
        ep->rep_attr.sq_sig_type = IB_SIGNAL_REQ_WR;
        ep->rep_attr.qp_type = IB_QPT_RC;
@@ -796,11 +785,11 @@ static void rpcrdma_sendctxs_destroy(struct rpcrdma_buffer *buf)
        kfree(buf->rb_sc_ctxs);
 }
 
-static struct rpcrdma_sendctx *rpcrdma_sendctx_create(struct rpcrdma_ia *ia)
+static struct rpcrdma_sendctx *rpcrdma_sendctx_create(struct rpcrdma_ep *ep)
 {
        struct rpcrdma_sendctx *sc;
 
-       sc = kzalloc(struct_size(sc, sc_sges, ia->ri_max_send_sges),
+       sc = kzalloc(struct_size(sc, sc_sges, ep->rep_attr.cap.max_send_sge),
                     GFP_KERNEL);
        if (!sc)
                return NULL;
@@ -828,7 +817,7 @@ static int rpcrdma_sendctxs_create(struct rpcrdma_xprt *r_xprt)
 
        buf->rb_sc_last = i - 1;
        for (i = 0; i <= buf->rb_sc_last; i++) {
-               sc = rpcrdma_sendctx_create(&r_xprt->rx_ia);
+               sc = rpcrdma_sendctx_create(&r_xprt->rx_ep);
                if (!sc)
                        return -ENOMEM;
 
index d796d68609edbf9c0515b26f6488e095ba2c9983..7655a99fd5596a0f5f31857e4d6924e6fae3780b 100644 (file)
@@ -73,7 +73,6 @@ struct rpcrdma_ia {
        int                     ri_async_rc;
        unsigned int            ri_max_segs;
        unsigned int            ri_max_frwr_depth;
-       unsigned int            ri_max_send_sges;
        bool                    ri_implicit_roundup;
        enum ib_mr_type         ri_mrtype;
        unsigned long           ri_flags;