]> git.baikalelectronics.ru Git - kernel.git/commitdiff
xprtrdma: Refactor rpcrdma_ep_connect() and rpcrdma_ep_disconnect()
authorChuck Lever <chuck.lever@oracle.com>
Fri, 21 Feb 2020 22:00:28 +0000 (17:00 -0500)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Fri, 27 Mar 2020 14:47:24 +0000 (10:47 -0400)
Clean up: Simplify the synopses of functions in the connect and
disconnect paths in preparation for combining the rpcrdma_ia and
struct rpcrdma_ep structures.

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

index 8934c24a57010ecce10bf58eba0e33edbf88c792..6349e6c98b57d6909f2906ba07159bbc45893369 100644 (file)
@@ -240,7 +240,7 @@ xprt_rdma_connect_worker(struct work_struct *work)
        struct rpc_xprt *xprt = &r_xprt->rx_xprt;
        int rc;
 
-       rc = rpcrdma_ep_connect(&r_xprt->rx_ep, &r_xprt->rx_ia);
+       rc = rpcrdma_xprt_connect(r_xprt);
        xprt_clear_connecting(xprt);
        if (r_xprt->rx_ep.rep_connected > 0) {
                xprt->stat.connect_count++;
@@ -284,7 +284,7 @@ xprt_rdma_destroy(struct rpc_xprt *xprt)
 
        cancel_delayed_work_sync(&r_xprt->rx_connect_worker);
 
-       rpcrdma_ep_disconnect(&r_xprt->rx_ep, &r_xprt->rx_ia);
+       rpcrdma_xprt_disconnect(r_xprt);
        rpcrdma_buffer_destroy(&r_xprt->rx_buf);
        rpcrdma_ia_close(&r_xprt->rx_ia);
 
@@ -409,7 +409,7 @@ void xprt_rdma_close(struct rpc_xprt *xprt)
 
        if (ep->rep_connected == -ENODEV)
                return;
-       rpcrdma_ep_disconnect(ep, ia);
+       rpcrdma_xprt_disconnect(r_xprt);
 
 out:
        xprt->reestablish_timeout = 0;
index 8fd6682d2646f49b9cf436e11e3ff3d4fa387c9b..f361213a81577491ea0b4dab4c5920116319c521 100644 (file)
@@ -610,15 +610,17 @@ out:
        return rc;
 }
 
-/*
- * Connect unconnected endpoint.
+/**
+ * rpcrdma_xprt_connect - Connect an unconnected transport
+ * @r_xprt: controlling transport instance
+ *
+ * Returns 0 on success or a negative errno.
  */
-int
-rpcrdma_ep_connect(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia)
+int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt)
 {
-       struct rpcrdma_xprt *r_xprt = container_of(ia, struct rpcrdma_xprt,
-                                                  rx_ia);
        struct rpc_xprt *xprt = &r_xprt->rx_xprt;
+       struct rpcrdma_ep *ep = &r_xprt->rx_ep;
+       struct rpcrdma_ia *ia = &r_xprt->rx_ia;
        int rc;
 
 retry:
@@ -634,7 +636,7 @@ retry:
                        goto out_noupdate;
                break;
        case 1:
-               rpcrdma_ep_disconnect(ep, ia);
+               rpcrdma_xprt_disconnect(r_xprt);
                /* fall through */
        default:
                rc = rpcrdma_ep_reconnect(r_xprt);
@@ -668,7 +670,7 @@ retry:
 
        rc = rpcrdma_reqs_setup(r_xprt);
        if (rc) {
-               rpcrdma_ep_disconnect(ep, ia);
+               rpcrdma_xprt_disconnect(r_xprt);
                goto out;
        }
        rpcrdma_mrs_create(r_xprt);
@@ -683,18 +685,16 @@ out_noupdate:
 }
 
 /**
- * rpcrdma_ep_disconnect - Disconnect underlying transport
- * @ep: endpoint to disconnect
- * @ia: associated interface adapter
+ * rpcrdma_xprt_disconnect - Disconnect underlying transport
+ * @r_xprt: controlling transport instance
  *
  * Caller serializes. Either the transport send lock is held,
  * or we're being called to destroy the transport.
  */
-void
-rpcrdma_ep_disconnect(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia)
+void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt)
 {
-       struct rpcrdma_xprt *r_xprt = container_of(ep, struct rpcrdma_xprt,
-                                                  rx_ep);
+       struct rpcrdma_ep *ep = &r_xprt->rx_ep;
+       struct rpcrdma_ia *ia = &r_xprt->rx_ia;
        struct rdma_cm_id *id = ia->ri_id;
        int rc;
 
index 82ec4c25432f0c2c67851d6c4b0951f05b7228f8..9ead06b1d8a45d50855dffefc7dfc309ddd14886 100644 (file)
@@ -464,8 +464,8 @@ void rpcrdma_ia_close(struct rpcrdma_ia *);
 /*
  * Endpoint calls - xprtrdma/verbs.c
  */
-int rpcrdma_ep_connect(struct rpcrdma_ep *, struct rpcrdma_ia *);
-void rpcrdma_ep_disconnect(struct rpcrdma_ep *, struct rpcrdma_ia *);
+int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt);
+void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt);
 
 int rpcrdma_post_sends(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req);
 void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp);