Skip to content

Commit e46ac34

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Handle non-SEND completions via a callout
Allow each memory registration mode to plug in a callout that handles the completion of a memory registration operation. Signed-off-by: Chuck Lever <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Tested-by: Devesh Sharma <[email protected]> Tested-by: Meghana Cheripady <[email protected]> Tested-by: Veeresh U. Kokatnur <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 3968cb5 commit e46ac34

File tree

3 files changed

+28
-10
lines changed

3 files changed

+28
-10
lines changed

net/sunrpc/xprtrdma/frwr_ops.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,22 @@ frwr_op_maxpages(struct rpcrdma_xprt *r_xprt)
117117
rpcrdma_max_segments(r_xprt) * ia->ri_max_frmr_depth);
118118
}
119119

120+
/* If FAST_REG or LOCAL_INV failed, indicate the frmr needs to be reset. */
121+
static void
122+
frwr_sendcompletion(struct ib_wc *wc)
123+
{
124+
struct rpcrdma_mw *r;
125+
126+
if (likely(wc->status == IB_WC_SUCCESS))
127+
return;
128+
129+
/* WARNING: Only wr_id and status are reliable at this point */
130+
r = (struct rpcrdma_mw *)(unsigned long)wc->wr_id;
131+
dprintk("RPC: %s: frmr %p (stale), status %d\n",
132+
__func__, r, wc->status);
133+
r->r.frmr.fr_state = FRMR_IS_STALE;
134+
}
135+
120136
static int
121137
frwr_op_init(struct rpcrdma_xprt *r_xprt)
122138
{
@@ -148,6 +164,7 @@ frwr_op_init(struct rpcrdma_xprt *r_xprt)
148164

149165
list_add(&r->mw_list, &buf->rb_mws);
150166
list_add(&r->mw_all, &buf->rb_all);
167+
r->mw_sendcompletion = frwr_sendcompletion;
151168
}
152169

153170
return 0;

net/sunrpc/xprtrdma/verbs.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static const char * const wc_status[] = {
186186
"remote access error",
187187
"remote operation error",
188188
"transport retry counter exceeded",
189-
"RNR retrycounter exceeded",
189+
"RNR retry counter exceeded",
190190
"local RDD violation error",
191191
"remove invalid RD request",
192192
"operation aborted",
@@ -204,21 +204,17 @@ static const char * const wc_status[] = {
204204
static void
205205
rpcrdma_sendcq_process_wc(struct ib_wc *wc)
206206
{
207-
if (likely(wc->status == IB_WC_SUCCESS))
208-
return;
209-
210207
/* WARNING: Only wr_id and status are reliable at this point */
211-
if (wc->wr_id == 0ULL) {
212-
if (wc->status != IB_WC_WR_FLUSH_ERR)
208+
if (wc->wr_id == RPCRDMA_IGNORE_COMPLETION) {
209+
if (wc->status != IB_WC_SUCCESS &&
210+
wc->status != IB_WC_WR_FLUSH_ERR)
213211
pr_err("RPC: %s: SEND: %s\n",
214212
__func__, COMPLETION_MSG(wc->status));
215213
} else {
216214
struct rpcrdma_mw *r;
217215

218216
r = (struct rpcrdma_mw *)(unsigned long)wc->wr_id;
219-
r->r.frmr.fr_state = FRMR_IS_STALE;
220-
pr_err("RPC: %s: frmr %p (stale): %s\n",
221-
__func__, r, COMPLETION_MSG(wc->status));
217+
r->mw_sendcompletion(wc);
222218
}
223219
}
224220

@@ -1622,7 +1618,7 @@ rpcrdma_ep_post(struct rpcrdma_ia *ia,
16221618
}
16231619

16241620
send_wr.next = NULL;
1625-
send_wr.wr_id = 0ULL; /* no send cookie */
1621+
send_wr.wr_id = RPCRDMA_IGNORE_COMPLETION;
16261622
send_wr.sg_list = req->rl_send_iov;
16271623
send_wr.num_sge = req->rl_niovs;
16281624
send_wr.opcode = IB_WR_SEND;

net/sunrpc/xprtrdma/xprt_rdma.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ struct rpcrdma_ep {
106106
#define INIT_CQCOUNT(ep) atomic_set(&(ep)->rep_cqcount, (ep)->rep_cqinit)
107107
#define DECR_CQCOUNT(ep) atomic_sub_return(1, &(ep)->rep_cqcount)
108108

109+
/* Force completion handler to ignore the signal
110+
*/
111+
#define RPCRDMA_IGNORE_COMPLETION (0ULL)
112+
109113
/* Registered buffer -- registered kmalloc'd memory for RDMA SEND/RECV
110114
*
111115
* The below structure appears at the front of a large region of kmalloc'd
@@ -206,6 +210,7 @@ struct rpcrdma_mw {
206210
struct ib_fmr *fmr;
207211
struct rpcrdma_frmr frmr;
208212
} r;
213+
void (*mw_sendcompletion)(struct ib_wc *);
209214
struct list_head mw_list;
210215
struct list_head mw_all;
211216
};

0 commit comments

Comments
 (0)