Commit 93aa8e0a authored by Chuck Lever's avatar Chuck Lever Committed by Anna Schumaker

xprtrdma: Merge struct rpcrdma_ia into struct rpcrdma_ep

I eventually want to allocate rpcrdma_ep separately from struct
rpcrdma_xprt so that on occasion there can be more than one ep per
xprt.

The new struct rpcrdma_ep will contain all the fields currently in
rpcrdma_ia and in rpcrdma_ep. This is all the device and CM settings
for the connection, in addition to per-connection settings
negotiated with the remote.

Take this opportunity to rename the existing ep fields from rep_* to
re_* to disambiguate these from struct rpcrdma_rep.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent d6ccebf9
...@@ -104,7 +104,7 @@ DECLARE_EVENT_CLASS(xprtrdma_connect_class, ...@@ -104,7 +104,7 @@ DECLARE_EVENT_CLASS(xprtrdma_connect_class,
TP_fast_assign( TP_fast_assign(
__entry->r_xprt = r_xprt; __entry->r_xprt = r_xprt;
__entry->rc = rc; __entry->rc = rc;
__entry->connect_status = r_xprt->rx_ep.rep_connected; __entry->connect_status = r_xprt->rx_ep.re_connect_status;
__assign_str(addr, rpcrdma_addrstr(r_xprt)); __assign_str(addr, rpcrdma_addrstr(r_xprt));
__assign_str(port, rpcrdma_portstr(r_xprt)); __assign_str(port, rpcrdma_portstr(r_xprt));
), ),
...@@ -394,10 +394,10 @@ TRACE_EVENT(xprtrdma_inline_thresh, ...@@ -394,10 +394,10 @@ TRACE_EVENT(xprtrdma_inline_thresh,
const struct rpcrdma_ep *ep = &r_xprt->rx_ep; const struct rpcrdma_ep *ep = &r_xprt->rx_ep;
__entry->r_xprt = r_xprt; __entry->r_xprt = r_xprt;
__entry->inline_send = ep->rep_inline_send; __entry->inline_send = ep->re_inline_send;
__entry->inline_recv = ep->rep_inline_recv; __entry->inline_recv = ep->re_inline_recv;
__entry->max_send = ep->rep_max_inline_send; __entry->max_send = ep->re_max_inline_send;
__entry->max_recv = ep->rep_max_inline_recv; __entry->max_recv = ep->re_max_inline_recv;
__assign_str(addr, rpcrdma_addrstr(r_xprt)); __assign_str(addr, rpcrdma_addrstr(r_xprt));
__assign_str(port, rpcrdma_portstr(r_xprt)); __assign_str(port, rpcrdma_portstr(r_xprt));
), ),
...@@ -803,7 +803,7 @@ TRACE_EVENT(xprtrdma_post_recvs, ...@@ -803,7 +803,7 @@ TRACE_EVENT(xprtrdma_post_recvs,
__entry->r_xprt = r_xprt; __entry->r_xprt = r_xprt;
__entry->count = count; __entry->count = count;
__entry->status = status; __entry->status = status;
__entry->posted = r_xprt->rx_ep.rep_receive_count; __entry->posted = r_xprt->rx_ep.re_receive_count;
__assign_str(addr, rpcrdma_addrstr(r_xprt)); __assign_str(addr, rpcrdma_addrstr(r_xprt));
__assign_str(port, rpcrdma_portstr(r_xprt)); __assign_str(port, rpcrdma_portstr(r_xprt));
), ),
......
...@@ -47,7 +47,7 @@ size_t xprt_rdma_bc_maxpayload(struct rpc_xprt *xprt) ...@@ -47,7 +47,7 @@ size_t xprt_rdma_bc_maxpayload(struct rpc_xprt *xprt)
struct rpcrdma_ep *ep = &r_xprt->rx_ep; struct rpcrdma_ep *ep = &r_xprt->rx_ep;
size_t maxmsg; size_t maxmsg;
maxmsg = min_t(unsigned int, ep->rep_inline_send, ep->rep_inline_recv); maxmsg = min_t(unsigned int, ep->re_inline_send, ep->re_inline_recv);
maxmsg = min_t(unsigned int, maxmsg, PAGE_SIZE); maxmsg = min_t(unsigned int, maxmsg, PAGE_SIZE);
return maxmsg - RPCRDMA_HDRLEN_MIN; return maxmsg - RPCRDMA_HDRLEN_MIN;
} }
...@@ -190,7 +190,7 @@ static struct rpc_rqst *rpcrdma_bc_rqst_get(struct rpcrdma_xprt *r_xprt) ...@@ -190,7 +190,7 @@ static struct rpc_rqst *rpcrdma_bc_rqst_get(struct rpcrdma_xprt *r_xprt)
if (xprt->bc_alloc_count >= RPCRDMA_BACKWARD_WRS) if (xprt->bc_alloc_count >= RPCRDMA_BACKWARD_WRS)
return NULL; return NULL;
size = min_t(size_t, r_xprt->rx_ep.rep_inline_recv, PAGE_SIZE); size = min_t(size_t, r_xprt->rx_ep.re_inline_recv, PAGE_SIZE);
req = rpcrdma_req_create(r_xprt, size, GFP_KERNEL); req = rpcrdma_req_create(r_xprt, size, GFP_KERNEL);
if (!req) if (!req)
return NULL; return NULL;
......
...@@ -74,7 +74,7 @@ static void frwr_mr_recycle(struct rpcrdma_mr *mr) ...@@ -74,7 +74,7 @@ static void frwr_mr_recycle(struct rpcrdma_mr *mr)
if (mr->mr_dir != DMA_NONE) { if (mr->mr_dir != DMA_NONE) {
trace_xprtrdma_mr_unmap(mr); trace_xprtrdma_mr_unmap(mr);
ib_dma_unmap_sg(r_xprt->rx_ia.ri_id->device, ib_dma_unmap_sg(r_xprt->rx_ep.re_id->device,
mr->mr_sg, mr->mr_nents, mr->mr_dir); mr->mr_sg, mr->mr_nents, mr->mr_dir);
mr->mr_dir = DMA_NONE; mr->mr_dir = DMA_NONE;
} }
...@@ -115,13 +115,13 @@ void frwr_reset(struct rpcrdma_req *req) ...@@ -115,13 +115,13 @@ void frwr_reset(struct rpcrdma_req *req)
*/ */
int frwr_mr_init(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr *mr) int frwr_mr_init(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr *mr)
{ {
struct rpcrdma_ia *ia = &r_xprt->rx_ia; struct rpcrdma_ep *ep = &r_xprt->rx_ep;
unsigned int depth = ia->ri_max_frwr_depth; unsigned int depth = ep->re_max_fr_depth;
struct scatterlist *sg; struct scatterlist *sg;
struct ib_mr *frmr; struct ib_mr *frmr;
int rc; int rc;
frmr = ib_alloc_mr(ia->ri_pd, ia->ri_mrtype, depth); frmr = ib_alloc_mr(ep->re_pd, ep->re_mrtype, depth);
if (IS_ERR(frmr)) if (IS_ERR(frmr))
goto out_mr_err; goto out_mr_err;
...@@ -151,29 +151,24 @@ int frwr_mr_init(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr *mr) ...@@ -151,29 +151,24 @@ int frwr_mr_init(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr *mr)
/** /**
* frwr_query_device - Prepare a transport for use with FRWR * frwr_query_device - Prepare a transport for use with FRWR
* @r_xprt: controlling transport instance * @ep: endpoint to fill in
* @device: RDMA device to query * @device: RDMA device to query
* *
* On success, sets: * On success, sets:
* ep->rep_attr * ep->re_attr
* ep->rep_max_requests * ep->re_max_requests
* ia->ri_max_rdma_segs * ep->re_max_rdma_segs
* * ep->re_max_fr_depth
* And these FRWR-related fields: * ep->re_mrtype
* ia->ri_max_frwr_depth
* ia->ri_mrtype
* *
* Return values: * Return values:
* On success, returns zero. * On success, returns zero.
* %-EINVAL - the device does not support FRWR memory registration * %-EINVAL - the device does not support FRWR memory registration
* %-ENOMEM - the device is not sufficiently capable for NFS/RDMA * %-ENOMEM - the device is not sufficiently capable for NFS/RDMA
*/ */
int frwr_query_device(struct rpcrdma_xprt *r_xprt, int frwr_query_device(struct rpcrdma_ep *ep, const struct ib_device *device)
const struct ib_device *device)
{ {
const struct ib_device_attr *attrs = &device->attrs; const struct ib_device_attr *attrs = &device->attrs;
struct rpcrdma_ia *ia = &r_xprt->rx_ia;
struct rpcrdma_ep *ep = &r_xprt->rx_ep;
int max_qp_wr, depth, delta; int max_qp_wr, depth, delta;
unsigned int max_sge; unsigned int max_sge;
...@@ -190,23 +185,23 @@ int frwr_query_device(struct rpcrdma_xprt *r_xprt, ...@@ -190,23 +185,23 @@ int frwr_query_device(struct rpcrdma_xprt *r_xprt,
pr_err("rpcrdma: HCA provides only %u send SGEs\n", max_sge); pr_err("rpcrdma: HCA provides only %u send SGEs\n", max_sge);
return -ENOMEM; return -ENOMEM;
} }
ep->rep_attr.cap.max_send_sge = max_sge; ep->re_attr.cap.max_send_sge = max_sge;
ep->rep_attr.cap.max_recv_sge = 1; ep->re_attr.cap.max_recv_sge = 1;
ia->ri_mrtype = IB_MR_TYPE_MEM_REG; ep->re_mrtype = IB_MR_TYPE_MEM_REG;
if (attrs->device_cap_flags & IB_DEVICE_SG_GAPS_REG) if (attrs->device_cap_flags & IB_DEVICE_SG_GAPS_REG)
ia->ri_mrtype = IB_MR_TYPE_SG_GAPS; ep->re_mrtype = IB_MR_TYPE_SG_GAPS;
/* Quirk: Some devices advertise a large max_fast_reg_page_list_len /* Quirk: Some devices advertise a large max_fast_reg_page_list_len
* capability, but perform optimally when the MRs are not larger * capability, but perform optimally when the MRs are not larger
* than a page. * than a page.
*/ */
if (attrs->max_sge_rd > RPCRDMA_MAX_HDR_SEGS) if (attrs->max_sge_rd > RPCRDMA_MAX_HDR_SEGS)
ia->ri_max_frwr_depth = attrs->max_sge_rd; ep->re_max_fr_depth = attrs->max_sge_rd;
else else
ia->ri_max_frwr_depth = attrs->max_fast_reg_page_list_len; ep->re_max_fr_depth = attrs->max_fast_reg_page_list_len;
if (ia->ri_max_frwr_depth > RPCRDMA_MAX_DATA_SEGS) if (ep->re_max_fr_depth > RPCRDMA_MAX_DATA_SEGS)
ia->ri_max_frwr_depth = RPCRDMA_MAX_DATA_SEGS; ep->re_max_fr_depth = RPCRDMA_MAX_DATA_SEGS;
/* Add room for frwr register and invalidate WRs. /* Add room for frwr register and invalidate WRs.
* 1. FRWR reg WR for head * 1. FRWR reg WR for head
...@@ -222,11 +217,11 @@ int frwr_query_device(struct rpcrdma_xprt *r_xprt, ...@@ -222,11 +217,11 @@ int frwr_query_device(struct rpcrdma_xprt *r_xprt,
/* Calculate N if the device max FRWR depth is smaller than /* Calculate N if the device max FRWR depth is smaller than
* RPCRDMA_MAX_DATA_SEGS. * RPCRDMA_MAX_DATA_SEGS.
*/ */
if (ia->ri_max_frwr_depth < RPCRDMA_MAX_DATA_SEGS) { if (ep->re_max_fr_depth < RPCRDMA_MAX_DATA_SEGS) {
delta = RPCRDMA_MAX_DATA_SEGS - ia->ri_max_frwr_depth; delta = RPCRDMA_MAX_DATA_SEGS - ep->re_max_fr_depth;
do { do {
depth += 2; /* FRWR reg + invalidate */ depth += 2; /* FRWR reg + invalidate */
delta -= ia->ri_max_frwr_depth; delta -= ep->re_max_fr_depth;
} while (delta > 0); } while (delta > 0);
} }
...@@ -235,34 +230,34 @@ int frwr_query_device(struct rpcrdma_xprt *r_xprt, ...@@ -235,34 +230,34 @@ int frwr_query_device(struct rpcrdma_xprt *r_xprt,
max_qp_wr -= 1; max_qp_wr -= 1;
if (max_qp_wr < RPCRDMA_MIN_SLOT_TABLE) if (max_qp_wr < RPCRDMA_MIN_SLOT_TABLE)
return -ENOMEM; return -ENOMEM;
if (ep->rep_max_requests > max_qp_wr) if (ep->re_max_requests > max_qp_wr)
ep->rep_max_requests = max_qp_wr; ep->re_max_requests = max_qp_wr;
ep->rep_attr.cap.max_send_wr = ep->rep_max_requests * depth; ep->re_attr.cap.max_send_wr = ep->re_max_requests * depth;
if (ep->rep_attr.cap.max_send_wr > max_qp_wr) { if (ep->re_attr.cap.max_send_wr > max_qp_wr) {
ep->rep_max_requests = max_qp_wr / depth; ep->re_max_requests = max_qp_wr / depth;
if (!ep->rep_max_requests) if (!ep->re_max_requests)
return -ENOMEM; return -ENOMEM;
ep->rep_attr.cap.max_send_wr = ep->rep_max_requests * depth; ep->re_attr.cap.max_send_wr = ep->re_max_requests * depth;
} }
ep->rep_attr.cap.max_send_wr += RPCRDMA_BACKWARD_WRS; ep->re_attr.cap.max_send_wr += RPCRDMA_BACKWARD_WRS;
ep->rep_attr.cap.max_send_wr += 1; /* for ib_drain_sq */ ep->re_attr.cap.max_send_wr += 1; /* for ib_drain_sq */
ep->rep_attr.cap.max_recv_wr = ep->rep_max_requests; ep->re_attr.cap.max_recv_wr = ep->re_max_requests;
ep->rep_attr.cap.max_recv_wr += RPCRDMA_BACKWARD_WRS; ep->re_attr.cap.max_recv_wr += RPCRDMA_BACKWARD_WRS;
ep->rep_attr.cap.max_recv_wr += 1; /* for ib_drain_rq */ ep->re_attr.cap.max_recv_wr += 1; /* for ib_drain_rq */
ia->ri_max_rdma_segs = ep->re_max_rdma_segs =
DIV_ROUND_UP(RPCRDMA_MAX_DATA_SEGS, ia->ri_max_frwr_depth); DIV_ROUND_UP(RPCRDMA_MAX_DATA_SEGS, ep->re_max_fr_depth);
/* Reply chunks require segments for head and tail buffers */ /* Reply chunks require segments for head and tail buffers */
ia->ri_max_rdma_segs += 2; ep->re_max_rdma_segs += 2;
if (ia->ri_max_rdma_segs > RPCRDMA_MAX_HDR_SEGS) if (ep->re_max_rdma_segs > RPCRDMA_MAX_HDR_SEGS)
ia->ri_max_rdma_segs = RPCRDMA_MAX_HDR_SEGS; ep->re_max_rdma_segs = RPCRDMA_MAX_HDR_SEGS;
/* Ensure the underlying device is capable of conveying the /* Ensure the underlying device is capable of conveying the
* largest r/wsize NFS will ask for. This guarantees that * largest r/wsize NFS will ask for. This guarantees that
* failing over from one RDMA device to another will not * failing over from one RDMA device to another will not
* break NFS I/O. * break NFS I/O.
*/ */
if ((ia->ri_max_rdma_segs * ia->ri_max_frwr_depth) < RPCRDMA_MAX_SEGS) if ((ep->re_max_rdma_segs * ep->re_max_fr_depth) < RPCRDMA_MAX_SEGS)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
...@@ -288,14 +283,14 @@ struct rpcrdma_mr_seg *frwr_map(struct rpcrdma_xprt *r_xprt, ...@@ -288,14 +283,14 @@ struct rpcrdma_mr_seg *frwr_map(struct rpcrdma_xprt *r_xprt,
int nsegs, bool writing, __be32 xid, int nsegs, bool writing, __be32 xid,
struct rpcrdma_mr *mr) struct rpcrdma_mr *mr)
{ {
struct rpcrdma_ia *ia = &r_xprt->rx_ia; struct rpcrdma_ep *ep = &r_xprt->rx_ep;
struct ib_reg_wr *reg_wr; struct ib_reg_wr *reg_wr;
int i, n, dma_nents; int i, n, dma_nents;
struct ib_mr *ibmr; struct ib_mr *ibmr;
u8 key; u8 key;
if (nsegs > ia->ri_max_frwr_depth) if (nsegs > ep->re_max_fr_depth)
nsegs = ia->ri_max_frwr_depth; nsegs = ep->re_max_fr_depth;
for (i = 0; i < nsegs;) { for (i = 0; i < nsegs;) {
if (seg->mr_page) if (seg->mr_page)
sg_set_page(&mr->mr_sg[i], sg_set_page(&mr->mr_sg[i],
...@@ -308,7 +303,7 @@ struct rpcrdma_mr_seg *frwr_map(struct rpcrdma_xprt *r_xprt, ...@@ -308,7 +303,7 @@ struct rpcrdma_mr_seg *frwr_map(struct rpcrdma_xprt *r_xprt,
++seg; ++seg;
++i; ++i;
if (ia->ri_mrtype == IB_MR_TYPE_SG_GAPS) if (ep->re_mrtype == IB_MR_TYPE_SG_GAPS)
continue; continue;
if ((i < nsegs && offset_in_page(seg->mr_offset)) || if ((i < nsegs && offset_in_page(seg->mr_offset)) ||
offset_in_page((seg-1)->mr_offset + (seg-1)->mr_len)) offset_in_page((seg-1)->mr_offset + (seg-1)->mr_len))
...@@ -317,7 +312,7 @@ struct rpcrdma_mr_seg *frwr_map(struct rpcrdma_xprt *r_xprt, ...@@ -317,7 +312,7 @@ struct rpcrdma_mr_seg *frwr_map(struct rpcrdma_xprt *r_xprt,
mr->mr_dir = rpcrdma_data_dir(writing); mr->mr_dir = rpcrdma_data_dir(writing);
mr->mr_nents = i; mr->mr_nents = i;
dma_nents = ib_dma_map_sg(ia->ri_id->device, mr->mr_sg, mr->mr_nents, dma_nents = ib_dma_map_sg(ep->re_id->device, mr->mr_sg, mr->mr_nents,
mr->mr_dir); mr->mr_dir);
if (!dma_nents) if (!dma_nents)
goto out_dmamap_err; goto out_dmamap_err;
...@@ -391,7 +386,6 @@ static void frwr_wc_fastreg(struct ib_cq *cq, struct ib_wc *wc) ...@@ -391,7 +386,6 @@ static void frwr_wc_fastreg(struct ib_cq *cq, struct ib_wc *wc)
*/ */
int frwr_send(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) int frwr_send(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
{ {
struct rpcrdma_ia *ia = &r_xprt->rx_ia;
struct ib_send_wr *post_wr; struct ib_send_wr *post_wr;
struct rpcrdma_mr *mr; struct rpcrdma_mr *mr;
...@@ -411,7 +405,7 @@ int frwr_send(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) ...@@ -411,7 +405,7 @@ int frwr_send(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
post_wr = &frwr->fr_regwr.wr; post_wr = &frwr->fr_regwr.wr;
} }
return ib_post_send(ia->ri_id->qp, post_wr, NULL); return ib_post_send(r_xprt->rx_ep.re_id->qp, post_wr, NULL);
} }
/** /**
...@@ -538,10 +532,10 @@ void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) ...@@ -538,10 +532,10 @@ void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
/* Transport disconnect drains the receive CQ before it /* Transport disconnect drains the receive CQ before it
* replaces the QP. The RPC reply handler won't call us * replaces the QP. The RPC reply handler won't call us
* unless ri_id->qp is a valid pointer. * unless re_id->qp is a valid pointer.
*/ */
bad_wr = NULL; bad_wr = NULL;
rc = ib_post_send(r_xprt->rx_ia.ri_id->qp, first, &bad_wr); rc = ib_post_send(r_xprt->rx_ep.re_id->qp, first, &bad_wr);
/* The final LOCAL_INV WR in the chain is supposed to /* The final LOCAL_INV WR in the chain is supposed to
* do the wake. If it was never posted, the wake will * do the wake. If it was never posted, the wake will
...@@ -643,10 +637,10 @@ void frwr_unmap_async(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) ...@@ -643,10 +637,10 @@ void frwr_unmap_async(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
/* Transport disconnect drains the receive CQ before it /* Transport disconnect drains the receive CQ before it
* replaces the QP. The RPC reply handler won't call us * replaces the QP. The RPC reply handler won't call us
* unless ri_id->qp is a valid pointer. * unless re_id->qp is a valid pointer.
*/ */
bad_wr = NULL; bad_wr = NULL;
rc = ib_post_send(r_xprt->rx_ia.ri_id->qp, first, &bad_wr); rc = ib_post_send(r_xprt->rx_ep.re_id->qp, first, &bad_wr);
if (!rc) if (!rc)
return; return;
......
...@@ -103,21 +103,20 @@ static unsigned int rpcrdma_max_reply_header_size(unsigned int maxsegs) ...@@ -103,21 +103,20 @@ static unsigned int rpcrdma_max_reply_header_size(unsigned int maxsegs)
/** /**
* rpcrdma_set_max_header_sizes - Initialize inline payload sizes * rpcrdma_set_max_header_sizes - Initialize inline payload sizes
* @r_xprt: transport instance to initialize * @ep: endpoint to initialize
* *
* The max_inline fields contain the maximum size of an RPC message * The max_inline fields contain the maximum size of an RPC message
* so the marshaling code doesn't have to repeat this calculation * so the marshaling code doesn't have to repeat this calculation
* for every RPC. * for every RPC.
*/ */
void rpcrdma_set_max_header_sizes(struct rpcrdma_xprt *r_xprt) void rpcrdma_set_max_header_sizes(struct rpcrdma_ep *ep)
{ {
unsigned int maxsegs = r_xprt->rx_ia.ri_max_rdma_segs; unsigned int maxsegs = ep->re_max_rdma_segs;
struct rpcrdma_ep *ep = &r_xprt->rx_ep;
ep->rep_max_inline_send = ep->re_max_inline_send =
ep->rep_inline_send - rpcrdma_max_call_header_size(maxsegs); ep->re_inline_send - rpcrdma_max_call_header_size(maxsegs);
ep->rep_max_inline_recv = ep->re_max_inline_recv =
ep->rep_inline_recv - rpcrdma_max_reply_header_size(maxsegs); ep->re_inline_recv - rpcrdma_max_reply_header_size(maxsegs);
} }
/* The client can send a request inline as long as the RPCRDMA header /* The client can send a request inline as long as the RPCRDMA header
...@@ -134,7 +133,7 @@ static bool rpcrdma_args_inline(struct rpcrdma_xprt *r_xprt, ...@@ -134,7 +133,7 @@ static bool rpcrdma_args_inline(struct rpcrdma_xprt *r_xprt,
struct xdr_buf *xdr = &rqst->rq_snd_buf; struct xdr_buf *xdr = &rqst->rq_snd_buf;
unsigned int count, remaining, offset; unsigned int count, remaining, offset;
if (xdr->len > r_xprt->rx_ep.rep_max_inline_send) if (xdr->len > r_xprt->rx_ep.re_max_inline_send)
return false; return false;
if (xdr->page_len) { if (xdr->page_len) {
...@@ -145,7 +144,7 @@ static bool rpcrdma_args_inline(struct rpcrdma_xprt *r_xprt, ...@@ -145,7 +144,7 @@ static bool rpcrdma_args_inline(struct rpcrdma_xprt *r_xprt,
remaining -= min_t(unsigned int, remaining -= min_t(unsigned int,
PAGE_SIZE - offset, remaining); PAGE_SIZE - offset, remaining);
offset = 0; offset = 0;
if (++count > r_xprt->rx_ep.rep_attr.cap.max_send_sge) if (++count > r_xprt->rx_ep.re_attr.cap.max_send_sge)
return false; return false;
} }
} }
...@@ -162,7 +161,7 @@ static bool rpcrdma_args_inline(struct rpcrdma_xprt *r_xprt, ...@@ -162,7 +161,7 @@ static bool rpcrdma_args_inline(struct rpcrdma_xprt *r_xprt,
static bool rpcrdma_results_inline(struct rpcrdma_xprt *r_xprt, static bool rpcrdma_results_inline(struct rpcrdma_xprt *r_xprt,
struct rpc_rqst *rqst) struct rpc_rqst *rqst)
{ {
return rqst->rq_rcv_buf.buflen <= r_xprt->rx_ep.rep_max_inline_recv; return rqst->rq_rcv_buf.buflen <= r_xprt->rx_ep.re_max_inline_recv;
} }
/* The client is required to provide a Reply chunk if the maximum /* The client is required to provide a Reply chunk if the maximum
...@@ -176,7 +175,7 @@ rpcrdma_nonpayload_inline(const struct rpcrdma_xprt *r_xprt, ...@@ -176,7 +175,7 @@ rpcrdma_nonpayload_inline(const struct rpcrdma_xprt *r_xprt,
const struct xdr_buf *buf = &rqst->rq_rcv_buf; const struct xdr_buf *buf = &rqst->rq_rcv_buf;
return (buf->head[0].iov_len + buf->tail[0].iov_len) < return (buf->head[0].iov_len + buf->tail[0].iov_len) <
r_xprt->rx_ep.rep_max_inline_recv; r_xprt->rx_ep.re_max_inline_recv;
} }
/* Split @vec on page boundaries into SGEs. FMR registers pages, not /* Split @vec on page boundaries into SGEs. FMR registers pages, not
...@@ -255,7 +254,7 @@ rpcrdma_convert_iovs(struct rpcrdma_xprt *r_xprt, struct xdr_buf *xdrbuf, ...@@ -255,7 +254,7 @@ rpcrdma_convert_iovs(struct rpcrdma_xprt *r_xprt, struct xdr_buf *xdrbuf,
/* When encoding a Read chunk, the tail iovec contains an /* When encoding a Read chunk, the tail iovec contains an
* XDR pad and may be omitted. * XDR pad and may be omitted.
*/ */
if (type == rpcrdma_readch && r_xprt->rx_ia.ri_implicit_roundup) if (type == rpcrdma_readch && r_xprt->rx_ep.re_implicit_roundup)
goto out; goto out;
/* When encoding a Write chunk, some servers need to see an /* When encoding a Write chunk, some servers need to see an
...@@ -263,7 +262,7 @@ rpcrdma_convert_iovs(struct rpcrdma_xprt *r_xprt, struct xdr_buf *xdrbuf, ...@@ -263,7 +262,7 @@ rpcrdma_convert_iovs(struct rpcrdma_xprt *r_xprt, struct xdr_buf *xdrbuf,
* layer provides space in the tail iovec that may be used * layer provides space in the tail iovec that may be used
* for this purpose. * for this purpose.
*/ */
if (type == rpcrdma_writech && r_xprt->rx_ia.ri_implicit_roundup) if (type == rpcrdma_writech && r_xprt->rx_ep.re_implicit_roundup)
goto out; goto out;
if (xdrbuf->tail[0].iov_len) if (xdrbuf->tail[0].iov_len)
...@@ -1476,8 +1475,8 @@ void rpcrdma_reply_handler(struct rpcrdma_rep *rep) ...@@ -1476,8 +1475,8 @@ void rpcrdma_reply_handler(struct rpcrdma_rep *rep)
if (credits == 0) if (credits == 0)
credits = 1; /* don't deadlock */ credits = 1; /* don't deadlock */
else if (credits > r_xprt->rx_ep.rep_max_requests) else if (credits > r_xprt->rx_ep.re_max_requests)
credits = r_xprt->rx_ep.rep_max_requests; credits = r_xprt->rx_ep.re_max_requests;
if (buf->rb_credits != credits) if (buf->rb_credits != credits)
rpcrdma_update_cwnd(r_xprt, credits); rpcrdma_update_cwnd(r_xprt, credits);
rpcrdma_post_recvs(r_xprt, false); rpcrdma_post_recvs(r_xprt, false);
......
...@@ -238,11 +238,12 @@ xprt_rdma_connect_worker(struct work_struct *work) ...@@ -238,11 +238,12 @@ xprt_rdma_connect_worker(struct work_struct *work)
struct rpcrdma_xprt *r_xprt = container_of(work, struct rpcrdma_xprt, struct rpcrdma_xprt *r_xprt = container_of(work, struct rpcrdma_xprt,
rx_connect_worker.work); rx_connect_worker.work);
struct rpc_xprt *xprt = &r_xprt->rx_xprt; struct rpc_xprt *xprt = &r_xprt->rx_xprt;
struct rpcrdma_ep *ep = &r_xprt->rx_ep;
int rc; int rc;
rc = rpcrdma_xprt_connect(r_xprt); rc = rpcrdma_xprt_connect(r_xprt);
xprt_clear_connecting(xprt); xprt_clear_connecting(xprt);
if (r_xprt->rx_ep.rep_connected > 0) { if (ep->re_connect_status > 0) {
xprt->stat.connect_count++; xprt->stat.connect_count++;
xprt->stat.connect_time += (long)jiffies - xprt->stat.connect_time += (long)jiffies -
xprt->stat.connect_start; xprt->stat.connect_start;
...@@ -265,7 +266,7 @@ xprt_rdma_inject_disconnect(struct rpc_xprt *xprt) ...@@ -265,7 +266,7 @@ xprt_rdma_inject_disconnect(struct rpc_xprt *xprt)
struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
trace_xprtrdma_op_inject_dsc(r_xprt); trace_xprtrdma_op_inject_dsc(r_xprt);
rdma_disconnect(r_xprt->rx_ia.ri_id); rdma_disconnect(r_xprt->rx_ep.re_id);
} }
/** /**
...@@ -355,6 +356,7 @@ xprt_setup_rdma(struct xprt_create *args) ...@@ -355,6 +356,7 @@ xprt_setup_rdma(struct xprt_create *args)
INIT_DELAYED_WORK(&new_xprt->rx_connect_worker, INIT_DELAYED_WORK(&new_xprt->rx_connect_worker,
xprt_rdma_connect_worker); xprt_rdma_connect_worker);
xprt->max_payload = RPCRDMA_MAX_DATA_SEGS << PAGE_SHIFT; xprt->max_payload = RPCRDMA_MAX_DATA_SEGS << PAGE_SHIFT;
dprintk("RPC: %s: %s:%s\n", __func__, dprintk("RPC: %s: %s:%s\n", __func__,
...@@ -489,10 +491,11 @@ static void ...@@ -489,10 +491,11 @@ static void
xprt_rdma_connect(struct rpc_xprt *xprt, struct rpc_task *task) xprt_rdma_connect(struct rpc_xprt *xprt, struct rpc_task *task)
{ {
struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
struct rpcrdma_ep *ep = &r_xprt->rx_ep;
unsigned long delay; unsigned long delay;
delay = 0; delay = 0;
if (r_xprt->rx_ep.rep_connected != 0) { if (ep->re_connect_status != 0) {
delay = xprt_reconnect_delay(xprt); delay = xprt_reconnect_delay(xprt);
xprt_reconnect_backoff(xprt, RPCRDMA_INIT_REEST_TO); xprt_reconnect_backoff(xprt, RPCRDMA_INIT_REEST_TO);
} }
......
...@@ -97,17 +97,17 @@ static void rpcrdma_regbuf_free(struct rpcrdma_regbuf *rb); ...@@ -97,17 +97,17 @@ static void rpcrdma_regbuf_free(struct rpcrdma_regbuf *rb);
*/ */
static void rpcrdma_xprt_drain(struct rpcrdma_xprt *r_xprt) static void rpcrdma_xprt_drain(struct rpcrdma_xprt *r_xprt)
{ {
struct rpcrdma_ia *ia = &r_xprt->rx_ia; struct rdma_cm_id *id = r_xprt->rx_ep.re_id;
/* Flush Receives, then wait for deferred Reply work /* Flush Receives, then wait for deferred Reply work
* to complete. * to complete.
*/ */
ib_drain_rq(ia->ri_id->qp); ib_drain_rq(id->qp);
/* Deferred Reply processing might have scheduled /* Deferred Reply processing might have scheduled
* local invalidations. * local invalidations.
*/ */
ib_drain_sq(ia->ri_id->qp); ib_drain_sq(id->qp);
} }
/** /**
...@@ -140,8 +140,9 @@ void rpcrdma_flush_disconnect(struct ib_cq *cq, struct ib_wc *wc) ...@@ -140,8 +140,9 @@ void rpcrdma_flush_disconnect(struct ib_cq *cq, struct ib_wc *wc)
struct rpcrdma_xprt *r_xprt = cq->cq_context; struct rpcrdma_xprt *r_xprt = cq->cq_context;
struct rpc_xprt *xprt = &r_xprt->rx_xprt; struct rpc_xprt *xprt = &r_xprt->rx_xprt;
if (wc->status != IB_WC_SUCCESS && r_xprt->rx_ep.rep_connected == 1) { if (wc->status != IB_WC_SUCCESS &&
r_xprt->rx_ep.rep_connected = -ECONNABORTED; r_xprt->rx_ep.re_connect_status == 1) {
r_xprt->rx_ep.re_connect_status = -ECONNABORTED;
trace_xprtrdma_flush_dct(r_xprt, wc->status); trace_xprtrdma_flush_dct(r_xprt, wc->status);
xprt_force_disconnect(xprt); xprt_force_disconnect(xprt);
} }
...@@ -180,7 +181,7 @@ static void rpcrdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc) ...@@ -180,7 +181,7 @@ static void rpcrdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc)
/* WARNING: Only wr_cqe and status are reliable at this point */ /* WARNING: Only wr_cqe and status are reliable at this point */
trace_xprtrdma_wc_receive(wc); trace_xprtrdma_wc_receive(wc);
--r_xprt->rx_ep.rep_receive_count; --r_xprt->rx_ep.re_receive_count;
if (wc->status != IB_WC_SUCCESS) if (wc->status != IB_WC_SUCCESS)
goto out_flushed; goto out_flushed;
...@@ -209,24 +210,24 @@ static void rpcrdma_update_cm_private(struct rpcrdma_xprt *r_xprt, ...@@ -209,24 +210,24 @@ static void rpcrdma_update_cm_private(struct rpcrdma_xprt *r_xprt,
unsigned int rsize, wsize; unsigned int rsize, wsize;
/* Default settings for RPC-over-RDMA Version One */ /* Default settings for RPC-over-RDMA Version One */
r_xprt->rx_ia.ri_implicit_roundup = xprt_rdma_pad_optimize; ep->re_implicit_roundup = xprt_rdma_pad_optimize;
rsize = RPCRDMA_V1_DEF_INLINE_SIZE; rsize = RPCRDMA_V1_DEF_INLINE_SIZE;
wsize = RPCRDMA_V1_DEF_INLINE_SIZE; wsize = RPCRDMA_V1_DEF_INLINE_SIZE;
if (pmsg && if (pmsg &&
pmsg->cp_magic == rpcrdma_cmp_magic && pmsg->cp_magic == rpcrdma_cmp_magic &&
pmsg->cp_version == RPCRDMA_CMP_VERSION) { pmsg->cp_version == RPCRDMA_CMP_VERSION) {
r_xprt->rx_ia.ri_implicit_roundup = true; ep->re_implicit_roundup = true;
rsize = rpcrdma_decode_buffer_size(pmsg->cp_send_size); rsize = rpcrdma_decode_buffer_size(pmsg->cp_send_size);
wsize = rpcrdma_decode_buffer_size(pmsg->cp_recv_size); wsize = rpcrdma_decode_buffer_size(pmsg->cp_recv_size);
} }
if (rsize < ep->rep_inline_recv) if (rsize < ep->re_inline_recv)
ep->rep_inline_recv = rsize; ep->re_inline_recv = rsize;
if (wsize < ep->rep_inline_send) if (wsize < ep->re_inline_send)
ep->rep_inline_send = wsize; ep->re_inline_send = wsize;
rpcrdma_set_max_header_sizes(r_xprt); rpcrdma_set_max_header_sizes(ep);
} }
/** /**
...@@ -241,7 +242,6 @@ static int ...@@ -241,7 +242,6 @@ static int
rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)
{ {
struct rpcrdma_xprt *r_xprt = id->context; struct rpcrdma_xprt *r_xprt = id->context;
struct rpcrdma_ia *ia = &r_xprt->rx_ia;
struct rpcrdma_ep *ep = &r_xprt->rx_ep; struct rpcrdma_ep *ep = &r_xprt->rx_ep;
struct rpc_xprt *xprt = &r_xprt->rx_xprt; struct rpc_xprt *xprt = &r_xprt->rx_xprt;
...@@ -251,57 +251,57 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) ...@@ -251,57 +251,57 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)
switch (event->event) { switch (event->event) {
case RDMA_CM_EVENT_ADDR_RESOLVED: case RDMA_CM_EVENT_ADDR_RESOLVED:
case RDMA_CM_EVENT_ROUTE_RESOLVED: case RDMA_CM_EVENT_ROUTE_RESOLVED:
ia->ri_async_rc = 0; ep->re_async_rc = 0;
complete(&ia->ri_done); complete(&ep->re_done);
return 0; return 0;
case RDMA_CM_EVENT_ADDR_ERROR: case RDMA_CM_EVENT_ADDR_ERROR:
ia->ri_async_rc = -EPROTO; ep->re_async_rc = -EPROTO;
complete(&ia->ri_done); complete(&ep->re_done);
return 0; return 0;
case RDMA_CM_EVENT_ROUTE_ERROR: case RDMA_CM_EVENT_ROUTE_ERROR:
ia->ri_async_rc = -ENETUNREACH; ep->re_async_rc = -ENETUNREACH;
complete(&ia->ri_done); complete(&ep->re_done);
return 0; return 0;
case RDMA_CM_EVENT_DEVICE_REMOVAL: case RDMA_CM_EVENT_DEVICE_REMOVAL:
#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
pr_info("rpcrdma: removing device %s for %s:%s\n", pr_info("rpcrdma: removing device %s for %s:%s\n",
ia->ri_id->device->name, ep->re_id->device->name,
rpcrdma_addrstr(r_xprt), rpcrdma_portstr(r_xprt)); rpcrdma_addrstr(r_xprt), rpcrdma_portstr(r_xprt));
#endif #endif
init_completion(&ia->ri_remove_done); init_completion(&ep->re_remove_done);
ep->rep_connected = -ENODEV; ep->re_connect_status = -ENODEV;
xprt_force_disconnect(xprt); xprt_force_disconnect(xprt);
wait_for_completion(&ia->ri_remove_done); wait_for_completion(&ep->re_remove_done);
trace_xprtrdma_remove(r_xprt); trace_xprtrdma_remove(r_xprt);
/* Return 1 to ensure the core destroys the id. */ /* Return 1 to ensure the core destroys the id. */
return 1; return 1;
case RDMA_CM_EVENT_ESTABLISHED: case RDMA_CM_EVENT_ESTABLISHED:
++xprt->connect_cookie; ++xprt->connect_cookie;
ep->rep_connected = 1; ep->re_connect_status = 1;
rpcrdma_update_cm_private(r_xprt, &event->param.conn); rpcrdma_update_cm_private(r_xprt, &event->param.conn);
trace_xprtrdma_inline_thresh(r_xprt); trace_xprtrdma_inline_thresh(r_xprt);
wake_up_all(&ep->rep_connect_wait); wake_up_all(&ep->re_connect_wait);
break; break;
case RDMA_CM_EVENT_CONNECT_ERROR: case RDMA_CM_EVENT_CONNECT_ERROR:
ep->rep_connected = -ENOTCONN; ep->re_connect_status = -ENOTCONN;
goto disconnected; goto disconnected;
case RDMA_CM_EVENT_UNREACHABLE: case RDMA_CM_EVENT_UNREACHABLE:
ep->rep_connected = -ENETUNREACH; ep->re_connect_status = -ENETUNREACH;
goto disconnected; goto disconnected;
case RDMA_CM_EVENT_REJECTED: case RDMA_CM_EVENT_REJECTED:
dprintk("rpcrdma: connection to %s:%s rejected: %s\n", dprintk("rpcrdma: connection to %s:%s rejected: %s\n",
rpcrdma_addrstr(r_xprt), rpcrdma_portstr(r_xprt), rpcrdma_addrstr(r_xprt), rpcrdma_portstr(r_xprt),
rdma_reject_msg(id, event->status)); rdma_reject_msg(id, event->status));
ep->rep_connected = -ECONNREFUSED; ep->re_connect_status = -ECONNREFUSED;
if (event->status == IB_CM_REJ_STALE_CONN) if (event->status == IB_CM_REJ_STALE_CONN)
ep->rep_connected = -EAGAIN; ep->re_connect_status = -EAGAIN;
goto disconnected; goto disconnected;
case RDMA_CM_EVENT_DISCONNECTED: case RDMA_CM_EVENT_DISCONNECTED:
ep->rep_connected = -ECONNABORTED; ep->re_connect_status = -ECONNABORTED;
disconnected: disconnected:
xprt_force_disconnect(xprt); xprt_force_disconnect(xprt);
wake_up_all(&ep->rep_connect_wait); wake_up_all(&ep->re_connect_wait);
break; break;
default: default:
break; break;
...@@ -309,46 +309,46 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) ...@@ -309,46 +309,46 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)
dprintk("RPC: %s: %s:%s on %s/frwr: %s\n", __func__, dprintk("RPC: %s: %s:%s on %s/frwr: %s\n", __func__,
rpcrdma_addrstr(r_xprt), rpcrdma_portstr(r_xprt), rpcrdma_addrstr(r_xprt), rpcrdma_portstr(r_xprt),
ia->ri_id->device->name, rdma_event_msg(event->event)); ep->re_id->device->name, rdma_event_msg(event->event));
return 0; return 0;
} }
static struct rdma_cm_id * static struct rdma_cm_id *rpcrdma_create_id(struct rpcrdma_xprt *r_xprt,
rpcrdma_create_id(struct rpcrdma_xprt *xprt, struct rpcrdma_ia *ia) struct rpcrdma_ep *ep)
{ {
unsigned long wtimeout = msecs_to_jiffies(RDMA_RESOLVE_TIMEOUT) + 1; unsigned long wtimeout = msecs_to_jiffies(RDMA_RESOLVE_TIMEOUT) + 1;
struct rpc_xprt *xprt = &r_xprt->rx_xprt;
struct rdma_cm_id *id; struct rdma_cm_id *id;
int rc; int rc;
init_completion(&ia->ri_done); init_completion(&ep->re_done);
id = rdma_create_id(xprt->rx_xprt.xprt_net, rpcrdma_cm_event_handler, id = rdma_create_id(xprt->xprt_net, rpcrdma_cm_event_handler, r_xprt,
xprt, RDMA_PS_TCP, IB_QPT_RC); RDMA_PS_TCP, IB_QPT_RC);
if (IS_ERR(id)) if (IS_ERR(id))
return id; return id;
ia->ri_async_rc = -ETIMEDOUT; ep->re_async_rc = -ETIMEDOUT;
rc = rdma_resolve_addr(id, NULL, rc = rdma_resolve_addr(id, NULL, (struct sockaddr *)&xprt->addr,
(struct sockaddr *)&xprt->rx_xprt.addr,
RDMA_RESOLVE_TIMEOUT); RDMA_RESOLVE_TIMEOUT);
if (rc) if (rc)
goto out; goto out;
rc = wait_for_completion_interruptible_timeout(&ia->ri_done, wtimeout); rc = wait_for_completion_interruptible_timeout(&ep->re_done, wtimeout);
if (rc < 0) if (rc < 0)
goto out; goto out;
rc = ia->ri_async_rc; rc = ep->re_async_rc;
if (rc) if (rc)
goto out; goto out;
ia->ri_async_rc = -ETIMEDOUT; ep->re_async_rc = -ETIMEDOUT;
rc = rdma_resolve_route(id, RDMA_RESOLVE_TIMEOUT); rc = rdma_resolve_route(id, RDMA_RESOLVE_TIMEOUT);
if (rc) if (rc)
goto out; goto out;
rc = wait_for_completion_interruptible_timeout(&ia->ri_done, wtimeout); rc = wait_for_completion_interruptible_timeout(&ep->re_done, wtimeout);
if (rc < 0) if (rc < 0)
goto out; goto out;
rc = ia->ri_async_rc; rc = ep->re_async_rc;
if (rc) if (rc)
goto out; goto out;
...@@ -366,102 +366,101 @@ rpcrdma_create_id(struct rpcrdma_xprt *xprt, struct rpcrdma_ia *ia) ...@@ -366,102 +366,101 @@ rpcrdma_create_id(struct rpcrdma_xprt *xprt, struct rpcrdma_ia *ia)
static int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt) static int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt)
{ {
struct rpcrdma_ep *ep = &r_xprt->rx_ep; struct rpcrdma_ep *ep = &r_xprt->rx_ep;
struct rpcrdma_ia *ia = &r_xprt->rx_ia; struct rpcrdma_connect_private *pmsg = &ep->re_cm_private;
struct rpcrdma_connect_private *pmsg = &ep->rep_cm_private;
struct rdma_cm_id *id; struct rdma_cm_id *id;
int rc; int rc;
id = rpcrdma_create_id(r_xprt, ia); id = rpcrdma_create_id(r_xprt, ep);
if (IS_ERR(id)) if (IS_ERR(id))
return PTR_ERR(id); return PTR_ERR(id);
ep->rep_max_requests = r_xprt->rx_xprt.max_reqs; ep->re_max_requests = r_xprt->rx_xprt.max_reqs;
ep->rep_inline_send = xprt_rdma_max_inline_write; ep->re_inline_send = xprt_rdma_max_inline_write;
ep->rep_inline_recv = xprt_rdma_max_inline_read; ep->re_inline_recv = xprt_rdma_max_inline_read;
rc = frwr_query_device(ep, id->device);
rc = frwr_query_device(r_xprt, id->device);
if (rc) if (rc)
goto out_destroy; goto out_destroy;
r_xprt->rx_buf.rb_max_requests = cpu_to_be32(ep->rep_max_requests); r_xprt->rx_buf.rb_max_requests = cpu_to_be32(ep->re_max_requests);
ep->rep_attr.event_handler = rpcrdma_qp_event_handler; ep->re_attr.event_handler = rpcrdma_qp_event_handler;
ep->rep_attr.qp_context = ep; ep->re_attr.qp_context = ep;
ep->rep_attr.srq = NULL; ep->re_attr.srq = NULL;
ep->rep_attr.cap.max_inline_data = 0; ep->re_attr.cap.max_inline_data = 0;
ep->rep_attr.sq_sig_type = IB_SIGNAL_REQ_WR; ep->re_attr.sq_sig_type = IB_SIGNAL_REQ_WR;
ep->rep_attr.qp_type = IB_QPT_RC; ep->re_attr.qp_type = IB_QPT_RC;
ep->rep_attr.port_num = ~0; ep->re_attr.port_num = ~0;
dprintk("RPC: %s: requested max: dtos: send %d recv %d; " dprintk("RPC: %s: requested max: dtos: send %d recv %d; "
"iovs: send %d recv %d\n", "iovs: send %d recv %d\n",
__func__, __func__,
ep->rep_attr.cap.max_send_wr, ep->re_attr.cap.max_send_wr,
ep->rep_attr.cap.max_recv_wr, ep->re_attr.cap.max_recv_wr,
ep->rep_attr.cap.max_send_sge, ep->re_attr.cap.max_send_sge,
ep->rep_attr.cap.max_recv_sge); ep->re_attr.cap.max_recv_sge);
ep->rep_send_batch = ep->rep_max_requests >> 3; ep->re_send_batch = ep->re_max_requests >> 3;
ep->rep_send_count = ep->rep_send_batch; ep->re_send_count = ep->re_send_batch;
init_waitqueue_head(&ep->rep_connect_wait); init_waitqueue_head(&ep->re_connect_wait);
ep->rep_receive_count = 0;
ep->re_attr.send_cq = ib_alloc_cq_any(id->device, r_xprt,
ep->rep_attr.send_cq = ib_alloc_cq_any(id->device, r_xprt, ep->re_attr.cap.max_send_wr,
ep->rep_attr.cap.max_send_wr,
IB_POLL_WORKQUEUE); IB_POLL_WORKQUEUE);
if (IS_ERR(ep->rep_attr.send_cq)) { if (IS_ERR(ep->re_attr.send_cq)) {
rc = PTR_ERR(ep->rep_attr.send_cq); rc = PTR_ERR(ep->re_attr.send_cq);
goto out_destroy; goto out_destroy;
} }
ep->rep_attr.recv_cq = ib_alloc_cq_any(id->device, r_xprt, ep->re_attr.recv_cq = ib_alloc_cq_any(id->device, r_xprt,
ep->rep_attr.cap.max_recv_wr, ep->re_attr.cap.max_recv_wr,
IB_POLL_WORKQUEUE); IB_POLL_WORKQUEUE);
if (IS_ERR(ep->rep_attr.recv_cq)) { if (IS_ERR(ep->re_attr.recv_cq)) {
rc = PTR_ERR(ep->rep_attr.recv_cq); rc = PTR_ERR(ep->re_attr.recv_cq);
goto out_destroy; goto out_destroy;
} }
ep->re_receive_count = 0;
/* Initialize cma parameters */ /* Initialize cma parameters */
memset(&ep->rep_remote_cma, 0, sizeof(ep->rep_remote_cma)); memset(&ep->re_remote_cma, 0, sizeof(ep->re_remote_cma));
/* Prepare RDMA-CM private message */ /* Prepare RDMA-CM private message */
pmsg->cp_magic = rpcrdma_cmp_magic; pmsg->cp_magic = rpcrdma_cmp_magic;
pmsg->cp_version = RPCRDMA_CMP_VERSION; pmsg->cp_version = RPCRDMA_CMP_VERSION;
pmsg->cp_flags |= RPCRDMA_CMP_F_SND_W_INV_OK; pmsg->cp_flags |= RPCRDMA_CMP_F_SND_W_INV_OK;
pmsg->cp_send_size = rpcrdma_encode_buffer_size(ep->rep_inline_send); pmsg->cp_send_size = rpcrdma_encode_buffer_size(ep->re_inline_send);
pmsg->cp_recv_size = rpcrdma_encode_buffer_size(ep->rep_inline_recv); pmsg->cp_recv_size = rpcrdma_encode_buffer_size(ep->re_inline_recv);
ep->rep_remote_cma.private_data = pmsg; ep->re_remote_cma.private_data = pmsg;
ep->rep_remote_cma.private_data_len = sizeof(*pmsg); ep->re_remote_cma.private_data_len = sizeof(*pmsg);
/* Client offers RDMA Read but does not initiate */ /* Client offers RDMA Read but does not initiate */
ep->rep_remote_cma.initiator_depth = 0; ep->re_remote_cma.initiator_depth = 0;
ep->rep_remote_cma.responder_resources = ep->re_remote_cma.responder_resources =
min_t(int, U8_MAX, id->device->attrs.max_qp_rd_atom); min_t(int, U8_MAX, id->device->attrs.max_qp_rd_atom);
/* Limit transport retries so client can detect server /* Limit transport retries so client can detect server
* GID changes quickly. RPC layer handles re-establishing * GID changes quickly. RPC layer handles re-establishing
* transport connection and retransmission. * transport connection and retransmission.
*/ */
ep->rep_remote_cma.retry_count = 6; ep->re_remote_cma.retry_count = 6;
/* RPC-over-RDMA handles its own flow control. In addition, /* RPC-over-RDMA handles its own flow control. In addition,
* make all RNR NAKs visible so we know that RPC-over-RDMA * make all RNR NAKs visible so we know that RPC-over-RDMA
* flow control is working correctly (no NAKs should be seen). * flow control is working correctly (no NAKs should be seen).
*/ */
ep->rep_remote_cma.flow_control = 0; ep->re_remote_cma.flow_control = 0;
ep->rep_remote_cma.rnr_retry_count = 0; ep->re_remote_cma.rnr_retry_count = 0;
ia->ri_pd = ib_alloc_pd(id->device, 0); ep->re_pd = ib_alloc_pd(id->device, 0);
if (IS_ERR(ia->ri_pd)) { if (IS_ERR(ep->re_pd)) {
rc = PTR_ERR(ia->ri_pd); rc = PTR_ERR(ep->re_pd);
goto out_destroy; goto out_destroy;
} }
rc = rdma_create_qp(id, ia->ri_pd, &ep->rep_attr); rc = rdma_create_qp(id, ep->re_pd, &ep->re_attr);
if (rc) if (rc)
goto out_destroy; goto out_destroy;
ia->ri_id = id;
ep->re_id = id;
return 0; return 0;
out_destroy: out_destroy:
...@@ -473,23 +472,22 @@ static int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt) ...@@ -473,23 +472,22 @@ static int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt)
static void rpcrdma_ep_destroy(struct rpcrdma_xprt *r_xprt) static void rpcrdma_ep_destroy(struct rpcrdma_xprt *r_xprt)
{ {
struct rpcrdma_ep *ep = &r_xprt->rx_ep; struct rpcrdma_ep *ep = &r_xprt->rx_ep;
struct rpcrdma_ia *ia = &r_xprt->rx_ia;
if (ia->ri_id && ia->ri_id->qp) { if (ep->re_id && ep->re_id->qp) {
rdma_destroy_qp(ia->ri_id); rdma_destroy_qp(ep->re_id);
ia->ri_id->qp = NULL; ep->re_id->qp = NULL;
} }
if (ep->rep_attr.recv_cq) if (ep->re_attr.recv_cq)
ib_free_cq(ep->rep_attr.recv_cq); ib_free_cq(ep->re_attr.recv_cq);
ep->rep_attr.recv_cq = NULL; ep->re_attr.recv_cq = NULL;
if (ep->rep_attr.send_cq) if (ep->re_attr.send_cq)
ib_free_cq(ep->rep_attr.send_cq); ib_free_cq(ep->re_attr.send_cq);
ep->rep_attr.send_cq = NULL; ep->re_attr.send_cq = NULL;
if (ia->ri_pd) if (ep->re_pd)
ib_dealloc_pd(ia->ri_pd); ib_dealloc_pd(ep->re_pd);
ia->ri_pd = NULL; ep->re_pd = NULL;
} }
/* /*
...@@ -499,7 +497,6 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt) ...@@ -499,7 +497,6 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt)
{ {
struct rpc_xprt *xprt = &r_xprt->rx_xprt; struct rpc_xprt *xprt = &r_xprt->rx_xprt;
struct rpcrdma_ep *ep = &r_xprt->rx_ep; struct rpcrdma_ep *ep = &r_xprt->rx_ep;
struct rpcrdma_ia *ia = &r_xprt->rx_ia;
int rc; int rc;
retry: retry:
...@@ -508,7 +505,7 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt) ...@@ -508,7 +505,7 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt)
if (rc) if (rc)
goto out_noupdate; goto out_noupdate;
ep->rep_connected = 0; ep->re_connect_status = 0;
xprt_clear_connected(xprt); xprt_clear_connected(xprt);
rpcrdma_reset_cwnd(r_xprt); rpcrdma_reset_cwnd(r_xprt);
...@@ -518,17 +515,18 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt) ...@@ -518,17 +515,18 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt)
if (rc) if (rc)
goto out; goto out;
rc = rdma_connect(ia->ri_id, &ep->rep_remote_cma); rc = rdma_connect(ep->re_id, &ep->re_remote_cma);
if (rc) if (rc)
goto out; goto out;
if (xprt->reestablish_timeout < RPCRDMA_INIT_REEST_TO) if (xprt->reestablish_timeout < RPCRDMA_INIT_REEST_TO)
xprt->reestablish_timeout = RPCRDMA_INIT_REEST_TO; xprt->reestablish_timeout = RPCRDMA_INIT_REEST_TO;
wait_event_interruptible(ep->rep_connect_wait, ep->rep_connected != 0); wait_event_interruptible(ep->re_connect_wait,
if (ep->rep_connected <= 0) { ep->re_connect_status != 0);
if (ep->rep_connected == -EAGAIN) if (ep->re_connect_status <= 0) {
if (ep->re_connect_status == -EAGAIN)
goto retry; goto retry;
rc = ep->rep_connected; rc = ep->re_connect_status;
goto out; goto out;
} }
...@@ -541,7 +539,7 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt) ...@@ -541,7 +539,7 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt)
out: out:
if (rc) if (rc)
ep->rep_connected = rc; ep->re_connect_status = rc;
out_noupdate: out_noupdate:
trace_xprtrdma_connect(r_xprt, rc); trace_xprtrdma_connect(r_xprt, rc);
...@@ -558,9 +556,8 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt) ...@@ -558,9 +556,8 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt)
void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt) void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt)
{ {
struct rpcrdma_ep *ep = &r_xprt->rx_ep; struct rpcrdma_ep *ep = &r_xprt->rx_ep;
struct rpcrdma_ia *ia = &r_xprt->rx_ia; struct rdma_cm_id *id = ep->re_id;
struct rdma_cm_id *id = ia->ri_id; int rc, status = ep->re_connect_status;
int rc, status = ep->rep_connected;
might_sleep(); might_sleep();
...@@ -569,10 +566,10 @@ void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt) ...@@ -569,10 +566,10 @@ void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt)
rc = rdma_disconnect(id); rc = rdma_disconnect(id);
if (!rc) if (!rc)
wait_event_interruptible(ep->rep_connect_wait, wait_event_interruptible(ep->re_connect_wait,
ep->rep_connected != 1); ep->re_connect_status != 1);
else else
ep->rep_connected = rc; ep->re_connect_status = rc;
trace_xprtrdma_disconnect(r_xprt, rc); trace_xprtrdma_disconnect(r_xprt, rc);
if (id->qp) if (id->qp)
...@@ -585,10 +582,10 @@ void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt) ...@@ -585,10 +582,10 @@ void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt)
rpcrdma_ep_destroy(r_xprt); rpcrdma_ep_destroy(r_xprt);
if (status == -ENODEV) if (status == -ENODEV)
complete(&ia->ri_remove_done); complete(&ep->re_remove_done);
else else
rdma_destroy_id(id); rdma_destroy_id(id);
ia->ri_id = NULL; ep->re_id = NULL;
} }
/* Fixed-size circular FIFO queue. This implementation is wait-free and /* Fixed-size circular FIFO queue. This implementation is wait-free and
...@@ -625,7 +622,7 @@ static struct rpcrdma_sendctx *rpcrdma_sendctx_create(struct rpcrdma_ep *ep) ...@@ -625,7 +622,7 @@ static struct rpcrdma_sendctx *rpcrdma_sendctx_create(struct rpcrdma_ep *ep)
{ {
struct rpcrdma_sendctx *sc; struct rpcrdma_sendctx *sc;
sc = kzalloc(struct_size(sc, sc_sges, ep->rep_attr.cap.max_send_sge), sc = kzalloc(struct_size(sc, sc_sges, ep->re_attr.cap.max_send_sge),
GFP_KERNEL); GFP_KERNEL);
if (!sc) if (!sc)
return NULL; return NULL;
...@@ -645,7 +642,7 @@ static int rpcrdma_sendctxs_create(struct rpcrdma_xprt *r_xprt) ...@@ -645,7 +642,7 @@ static int rpcrdma_sendctxs_create(struct rpcrdma_xprt *r_xprt)
* the ->send_request call to fail temporarily before too many * the ->send_request call to fail temporarily before too many
* Sends are posted. * Sends are posted.
*/ */
i = r_xprt->rx_ep.rep_max_requests + RPCRDMA_MAX_BC_REQUESTS; i = r_xprt->rx_ep.re_max_requests + RPCRDMA_MAX_BC_REQUESTS;
buf->rb_sc_ctxs = kcalloc(i, sizeof(sc), GFP_KERNEL); buf->rb_sc_ctxs = kcalloc(i, sizeof(sc), GFP_KERNEL);
if (!buf->rb_sc_ctxs) if (!buf->rb_sc_ctxs)
return -ENOMEM; return -ENOMEM;
...@@ -756,10 +753,10 @@ static void ...@@ -756,10 +753,10 @@ static void
rpcrdma_mrs_create(struct rpcrdma_xprt *r_xprt) rpcrdma_mrs_create(struct rpcrdma_xprt *r_xprt)
{ {
struct rpcrdma_buffer *buf = &r_xprt->rx_buf; struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
struct rpcrdma_ia *ia = &r_xprt->rx_ia; struct rpcrdma_ep *ep = &r_xprt->rx_ep;
unsigned int count; unsigned int count;
for (count = 0; count < ia->ri_max_rdma_segs; count++) { for (count = 0; count < ep->re_max_rdma_segs; count++) {
struct rpcrdma_mr *mr; struct rpcrdma_mr *mr;
int rc; int rc;
...@@ -808,7 +805,7 @@ void rpcrdma_mrs_refresh(struct rpcrdma_xprt *r_xprt) ...@@ -808,7 +805,7 @@ void rpcrdma_mrs_refresh(struct rpcrdma_xprt *r_xprt)
/* If there is no underlying connection, it's no use /* If there is no underlying connection, it's no use
* to wake the refresh worker. * to wake the refresh worker.
*/ */
if (ep->rep_connected == 1) { if (ep->re_connect_status == 1) {
/* The work is scheduled on a WQ_MEM_RECLAIM /* The work is scheduled on a WQ_MEM_RECLAIM
* workqueue in order to prevent MR allocation * workqueue in order to prevent MR allocation
* from recursing into NFS during direct reclaim. * from recursing into NFS during direct reclaim.
...@@ -872,7 +869,7 @@ int rpcrdma_req_setup(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) ...@@ -872,7 +869,7 @@ int rpcrdma_req_setup(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
/* Compute maximum header buffer size in bytes */ /* Compute maximum header buffer size in bytes */
maxhdrsize = rpcrdma_fixed_maxsz + 3 + maxhdrsize = rpcrdma_fixed_maxsz + 3 +
r_xprt->rx_ia.ri_max_rdma_segs * rpcrdma_readchunk_maxsz; r_xprt->rx_ep.re_max_rdma_segs * rpcrdma_readchunk_maxsz;
maxhdrsize *= sizeof(__be32); maxhdrsize *= sizeof(__be32);
rb = rpcrdma_regbuf_alloc(__roundup_pow_of_two(maxhdrsize), rb = rpcrdma_regbuf_alloc(__roundup_pow_of_two(maxhdrsize),
DMA_TO_DEVICE, GFP_KERNEL); DMA_TO_DEVICE, GFP_KERNEL);
...@@ -950,7 +947,7 @@ struct rpcrdma_rep *rpcrdma_rep_create(struct rpcrdma_xprt *r_xprt, ...@@ -950,7 +947,7 @@ struct rpcrdma_rep *rpcrdma_rep_create(struct rpcrdma_xprt *r_xprt,
if (rep == NULL) if (rep == NULL)
goto out; goto out;
rep->rr_rdmabuf = rpcrdma_regbuf_alloc(r_xprt->rx_ep.rep_inline_recv, rep->rr_rdmabuf = rpcrdma_regbuf_alloc(r_xprt->rx_ep.re_inline_recv,
DMA_FROM_DEVICE, GFP_KERNEL); DMA_FROM_DEVICE, GFP_KERNEL);
if (!rep->rr_rdmabuf) if (!rep->rr_rdmabuf)
goto out_free; goto out_free;
...@@ -1175,7 +1172,7 @@ void rpcrdma_mr_put(struct rpcrdma_mr *mr) ...@@ -1175,7 +1172,7 @@ void rpcrdma_mr_put(struct rpcrdma_mr *mr)
if (mr->mr_dir != DMA_NONE) { if (mr->mr_dir != DMA_NONE) {
trace_xprtrdma_mr_unmap(mr); trace_xprtrdma_mr_unmap(mr);
ib_dma_unmap_sg(r_xprt->rx_ia.ri_id->device, ib_dma_unmap_sg(r_xprt->rx_ep.re_id->device,
mr->mr_sg, mr->mr_nents, mr->mr_dir); mr->mr_sg, mr->mr_nents, mr->mr_dir);
mr->mr_dir = DMA_NONE; mr->mr_dir = DMA_NONE;
} }
...@@ -1293,7 +1290,7 @@ bool rpcrdma_regbuf_realloc(struct rpcrdma_regbuf *rb, size_t size, gfp_t flags) ...@@ -1293,7 +1290,7 @@ bool rpcrdma_regbuf_realloc(struct rpcrdma_regbuf *rb, size_t size, gfp_t flags)
bool __rpcrdma_regbuf_dma_map(struct rpcrdma_xprt *r_xprt, bool __rpcrdma_regbuf_dma_map(struct rpcrdma_xprt *r_xprt,
struct rpcrdma_regbuf *rb) struct rpcrdma_regbuf *rb)
{ {
struct ib_device *device = r_xprt->rx_ia.ri_id->device; struct ib_device *device = r_xprt->rx_ep.re_id->device;
if (rb->rg_direction == DMA_NONE) if (rb->rg_direction == DMA_NONE)
return false; return false;
...@@ -1306,7 +1303,7 @@ bool __rpcrdma_regbuf_dma_map(struct rpcrdma_xprt *r_xprt, ...@@ -1306,7 +1303,7 @@ bool __rpcrdma_regbuf_dma_map(struct rpcrdma_xprt *r_xprt,
} }
rb->rg_device = device; rb->rg_device = device;
rb->rg_iov.lkey = r_xprt->rx_ia.ri_pd->local_dma_lkey; rb->rg_iov.lkey = r_xprt->rx_ep.re_pd->local_dma_lkey;
return true; return true;
} }
...@@ -1345,12 +1342,12 @@ int rpcrdma_post_sends(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) ...@@ -1345,12 +1342,12 @@ int rpcrdma_post_sends(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
struct rpcrdma_ep *ep = &r_xprt->rx_ep; struct rpcrdma_ep *ep = &r_xprt->rx_ep;
int rc; int rc;
if (!ep->rep_send_count || kref_read(&req->rl_kref) > 1) { if (!ep->re_send_count || kref_read(&req->rl_kref) > 1) {
send_wr->send_flags |= IB_SEND_SIGNALED; send_wr->send_flags |= IB_SEND_SIGNALED;
ep->rep_send_count = ep->rep_send_batch; ep->re_send_count = ep->re_send_batch;
} else { } else {
send_wr->send_flags &= ~IB_SEND_SIGNALED; send_wr->send_flags &= ~IB_SEND_SIGNALED;
--ep->rep_send_count; --ep->re_send_count;
} }
rc = frwr_send(r_xprt, req); rc = frwr_send(r_xprt, req);
...@@ -1378,9 +1375,9 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp) ...@@ -1378,9 +1375,9 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp)
count = 0; count = 0;
needed = buf->rb_credits + (buf->rb_bc_srv_max_requests << 1); needed = buf->rb_credits + (buf->rb_bc_srv_max_requests << 1);
if (likely(ep->rep_receive_count > needed)) if (likely(ep->re_receive_count > needed))
goto out; goto out;
needed -= ep->rep_receive_count; needed -= ep->re_receive_count;
if (!temp) if (!temp)
needed += RPCRDMA_MAX_RECV_BATCH; needed += RPCRDMA_MAX_RECV_BATCH;
...@@ -1406,7 +1403,7 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp) ...@@ -1406,7 +1403,7 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp)
if (!wr) if (!wr)
goto out; goto out;
rc = ib_post_recv(r_xprt->rx_ia.ri_id->qp, wr, rc = ib_post_recv(r_xprt->rx_ep.re_id->qp, wr,
(const struct ib_recv_wr **)&bad_wr); (const struct ib_recv_wr **)&bad_wr);
out: out:
trace_xprtrdma_post_recvs(r_xprt, count, rc); trace_xprtrdma_post_recvs(r_xprt, count, rc);
...@@ -1420,6 +1417,6 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp) ...@@ -1420,6 +1417,6 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp)
--count; --count;
} }
} }
ep->rep_receive_count += count; ep->re_receive_count += count;
return; return;
} }
...@@ -65,38 +65,32 @@ ...@@ -65,38 +65,32 @@
#define RPCRDMA_IDLE_DISC_TO (5U * 60 * HZ) #define RPCRDMA_IDLE_DISC_TO (5U * 60 * HZ)
/* /*
* Interface Adapter -- one per transport instance * RDMA Endpoint -- connection endpoint details
*/ */
struct rpcrdma_ia {
struct rdma_cm_id *ri_id;
struct ib_pd *ri_pd;
int ri_async_rc;
unsigned int ri_max_rdma_segs;
unsigned int ri_max_frwr_depth;
bool ri_implicit_roundup;
enum ib_mr_type ri_mrtype;
struct completion ri_done;
struct completion ri_remove_done;
};
/*
* RDMA Endpoint -- one per transport instance
*/
struct rpcrdma_ep { struct rpcrdma_ep {
unsigned int rep_send_count; struct rdma_cm_id *re_id;
unsigned int rep_send_batch; struct ib_pd *re_pd;
unsigned int rep_max_inline_send; unsigned int re_max_rdma_segs;
unsigned int rep_max_inline_recv; unsigned int re_max_fr_depth;
int rep_connected; bool re_implicit_roundup;
struct ib_qp_init_attr rep_attr; enum ib_mr_type re_mrtype;
wait_queue_head_t rep_connect_wait; struct completion re_done;
struct rpcrdma_connect_private rep_cm_private; struct completion re_remove_done;
struct rdma_conn_param rep_remote_cma; unsigned int re_send_count;
unsigned int rep_max_requests; /* depends on device */ unsigned int re_send_batch;
unsigned int rep_inline_send; /* negotiated */ unsigned int re_max_inline_send;
unsigned int rep_inline_recv; /* negotiated */ unsigned int re_max_inline_recv;
int rep_receive_count; int re_async_rc;
int re_connect_status;
struct ib_qp_init_attr re_attr;
wait_queue_head_t re_connect_wait;
struct rpcrdma_connect_private
re_cm_private;
struct rdma_conn_param re_remote_cma;
int re_receive_count;
unsigned int re_max_requests; /* depends on device */
unsigned int re_inline_send; /* negotiated */
unsigned int re_inline_recv; /* negotiated */
}; };
/* Pre-allocate extra Work Requests for handling backward receives /* Pre-allocate extra Work Requests for handling backward receives
...@@ -417,7 +411,6 @@ struct rpcrdma_stats { ...@@ -417,7 +411,6 @@ struct rpcrdma_stats {
*/ */
struct rpcrdma_xprt { struct rpcrdma_xprt {
struct rpc_xprt rx_xprt; struct rpc_xprt rx_xprt;
struct rpcrdma_ia rx_ia;
struct rpcrdma_ep rx_ep; struct rpcrdma_ep rx_ep;
struct rpcrdma_buffer rx_buf; struct rpcrdma_buffer rx_buf;
struct delayed_work rx_connect_worker; struct delayed_work rx_connect_worker;
...@@ -522,8 +515,7 @@ rpcrdma_data_dir(bool writing) ...@@ -522,8 +515,7 @@ rpcrdma_data_dir(bool writing)
/* Memory registration calls xprtrdma/frwr_ops.c /* Memory registration calls xprtrdma/frwr_ops.c
*/ */
void frwr_reset(struct rpcrdma_req *req); void frwr_reset(struct rpcrdma_req *req);
int frwr_query_device(struct rpcrdma_xprt *r_xprt, int frwr_query_device(struct rpcrdma_ep *ep, const struct ib_device *device);
const struct ib_device *device);
int frwr_mr_init(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr *mr); int frwr_mr_init(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr *mr);
void frwr_release_mr(struct rpcrdma_mr *mr); void frwr_release_mr(struct rpcrdma_mr *mr);
struct rpcrdma_mr_seg *frwr_map(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr_seg *frwr_map(struct rpcrdma_xprt *r_xprt,
...@@ -555,7 +547,7 @@ int rpcrdma_prepare_send_sges(struct rpcrdma_xprt *r_xprt, ...@@ -555,7 +547,7 @@ int rpcrdma_prepare_send_sges(struct rpcrdma_xprt *r_xprt,
enum rpcrdma_chunktype rtype); enum rpcrdma_chunktype rtype);
void rpcrdma_sendctx_unmap(struct rpcrdma_sendctx *sc); void rpcrdma_sendctx_unmap(struct rpcrdma_sendctx *sc);
int rpcrdma_marshal_req(struct rpcrdma_xprt *r_xprt, struct rpc_rqst *rqst); int rpcrdma_marshal_req(struct rpcrdma_xprt *r_xprt, struct rpc_rqst *rqst);
void rpcrdma_set_max_header_sizes(struct rpcrdma_xprt *); void rpcrdma_set_max_header_sizes(struct rpcrdma_ep *ep);
void rpcrdma_reset_cwnd(struct rpcrdma_xprt *r_xprt); void rpcrdma_reset_cwnd(struct rpcrdma_xprt *r_xprt);
void rpcrdma_complete_rqst(struct rpcrdma_rep *rep); void rpcrdma_complete_rqst(struct rpcrdma_rep *rep);
void rpcrdma_reply_handler(struct rpcrdma_rep *rep); void rpcrdma_reply_handler(struct rpcrdma_rep *rep);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment