Skip to content

Commit 9144a80

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Refactor rpcrdma_ep_connect() and rpcrdma_ep_disconnect()
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 <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 97d0de8 commit 9144a80

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

net/sunrpc/xprtrdma/transport.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ xprt_rdma_connect_worker(struct work_struct *work)
240240
struct rpc_xprt *xprt = &r_xprt->rx_xprt;
241241
int rc;
242242

243-
rc = rpcrdma_ep_connect(&r_xprt->rx_ep, &r_xprt->rx_ia);
243+
rc = rpcrdma_xprt_connect(r_xprt);
244244
xprt_clear_connecting(xprt);
245245
if (r_xprt->rx_ep.rep_connected > 0) {
246246
xprt->stat.connect_count++;
@@ -284,7 +284,7 @@ xprt_rdma_destroy(struct rpc_xprt *xprt)
284284

285285
cancel_delayed_work_sync(&r_xprt->rx_connect_worker);
286286

287-
rpcrdma_ep_disconnect(&r_xprt->rx_ep, &r_xprt->rx_ia);
287+
rpcrdma_xprt_disconnect(r_xprt);
288288
rpcrdma_buffer_destroy(&r_xprt->rx_buf);
289289
rpcrdma_ia_close(&r_xprt->rx_ia);
290290

@@ -409,7 +409,7 @@ void xprt_rdma_close(struct rpc_xprt *xprt)
409409

410410
if (ep->rep_connected == -ENODEV)
411411
return;
412-
rpcrdma_ep_disconnect(ep, ia);
412+
rpcrdma_xprt_disconnect(r_xprt);
413413

414414
out:
415415
xprt->reestablish_timeout = 0;

net/sunrpc/xprtrdma/verbs.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -610,15 +610,17 @@ static int rpcrdma_ep_reconnect(struct rpcrdma_xprt *r_xprt)
610610
return rc;
611611
}
612612

613-
/*
614-
* Connect unconnected endpoint.
613+
/**
614+
* rpcrdma_xprt_connect - Connect an unconnected transport
615+
* @r_xprt: controlling transport instance
616+
*
617+
* Returns 0 on success or a negative errno.
615618
*/
616-
int
617-
rpcrdma_ep_connect(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia)
619+
int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt)
618620
{
619-
struct rpcrdma_xprt *r_xprt = container_of(ia, struct rpcrdma_xprt,
620-
rx_ia);
621621
struct rpc_xprt *xprt = &r_xprt->rx_xprt;
622+
struct rpcrdma_ep *ep = &r_xprt->rx_ep;
623+
struct rpcrdma_ia *ia = &r_xprt->rx_ia;
622624
int rc;
623625

624626
retry:
@@ -634,7 +636,7 @@ rpcrdma_ep_connect(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia)
634636
goto out_noupdate;
635637
break;
636638
case 1:
637-
rpcrdma_ep_disconnect(ep, ia);
639+
rpcrdma_xprt_disconnect(r_xprt);
638640
/* fall through */
639641
default:
640642
rc = rpcrdma_ep_reconnect(r_xprt);
@@ -668,7 +670,7 @@ rpcrdma_ep_connect(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia)
668670

669671
rc = rpcrdma_reqs_setup(r_xprt);
670672
if (rc) {
671-
rpcrdma_ep_disconnect(ep, ia);
673+
rpcrdma_xprt_disconnect(r_xprt);
672674
goto out;
673675
}
674676
rpcrdma_mrs_create(r_xprt);
@@ -683,18 +685,16 @@ rpcrdma_ep_connect(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia)
683685
}
684686

685687
/**
686-
* rpcrdma_ep_disconnect - Disconnect underlying transport
687-
* @ep: endpoint to disconnect
688-
* @ia: associated interface adapter
688+
* rpcrdma_xprt_disconnect - Disconnect underlying transport
689+
* @r_xprt: controlling transport instance
689690
*
690691
* Caller serializes. Either the transport send lock is held,
691692
* or we're being called to destroy the transport.
692693
*/
693-
void
694-
rpcrdma_ep_disconnect(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia)
694+
void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt)
695695
{
696-
struct rpcrdma_xprt *r_xprt = container_of(ep, struct rpcrdma_xprt,
697-
rx_ep);
696+
struct rpcrdma_ep *ep = &r_xprt->rx_ep;
697+
struct rpcrdma_ia *ia = &r_xprt->rx_ia;
698698
struct rdma_cm_id *id = ia->ri_id;
699699
int rc;
700700

net/sunrpc/xprtrdma/xprt_rdma.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ void rpcrdma_ia_close(struct rpcrdma_ia *);
464464
/*
465465
* Endpoint calls - xprtrdma/verbs.c
466466
*/
467-
int rpcrdma_ep_connect(struct rpcrdma_ep *, struct rpcrdma_ia *);
468-
void rpcrdma_ep_disconnect(struct rpcrdma_ep *, struct rpcrdma_ia *);
467+
int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt);
468+
void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt);
469469

470470
int rpcrdma_post_sends(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req);
471471
void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp);

0 commit comments

Comments
 (0)