@@ -162,14 +162,23 @@ rpcrdma_sendcq_process_wc(struct ib_wc *wc)
162
162
}
163
163
164
164
static int
165
- rpcrdma_sendcq_poll (struct ib_cq * cq )
165
+ rpcrdma_sendcq_poll (struct ib_cq * cq , struct rpcrdma_ep * ep )
166
166
{
167
- struct ib_wc wc ;
168
- int rc ;
167
+ struct ib_wc * wcs ;
168
+ int count , rc ;
169
169
170
- while ((rc = ib_poll_cq (cq , 1 , & wc )) == 1 )
171
- rpcrdma_sendcq_process_wc (& wc );
172
- return rc ;
170
+ do {
171
+ wcs = ep -> rep_send_wcs ;
172
+
173
+ rc = ib_poll_cq (cq , RPCRDMA_POLLSIZE , wcs );
174
+ if (rc <= 0 )
175
+ return rc ;
176
+
177
+ count = rc ;
178
+ while (count -- > 0 )
179
+ rpcrdma_sendcq_process_wc (wcs ++ );
180
+ } while (rc == RPCRDMA_POLLSIZE );
181
+ return 0 ;
173
182
}
174
183
175
184
/*
@@ -183,9 +192,10 @@ rpcrdma_sendcq_poll(struct ib_cq *cq)
183
192
static void
184
193
rpcrdma_sendcq_upcall (struct ib_cq * cq , void * cq_context )
185
194
{
195
+ struct rpcrdma_ep * ep = (struct rpcrdma_ep * )cq_context ;
186
196
int rc ;
187
197
188
- rc = rpcrdma_sendcq_poll (cq );
198
+ rc = rpcrdma_sendcq_poll (cq , ep );
189
199
if (rc ) {
190
200
dprintk ("RPC: %s: ib_poll_cq failed: %i\n" ,
191
201
__func__ , rc );
@@ -202,7 +212,7 @@ rpcrdma_sendcq_upcall(struct ib_cq *cq, void *cq_context)
202
212
return ;
203
213
}
204
214
205
- rpcrdma_sendcq_poll (cq );
215
+ rpcrdma_sendcq_poll (cq , ep );
206
216
}
207
217
208
218
static void
@@ -241,14 +251,23 @@ rpcrdma_recvcq_process_wc(struct ib_wc *wc)
241
251
}
242
252
243
253
static int
244
- rpcrdma_recvcq_poll (struct ib_cq * cq )
254
+ rpcrdma_recvcq_poll (struct ib_cq * cq , struct rpcrdma_ep * ep )
245
255
{
246
- struct ib_wc wc ;
247
- int rc ;
256
+ struct ib_wc * wcs ;
257
+ int count , rc ;
248
258
249
- while ((rc = ib_poll_cq (cq , 1 , & wc )) == 1 )
250
- rpcrdma_recvcq_process_wc (& wc );
251
- return rc ;
259
+ do {
260
+ wcs = ep -> rep_recv_wcs ;
261
+
262
+ rc = ib_poll_cq (cq , RPCRDMA_POLLSIZE , wcs );
263
+ if (rc <= 0 )
264
+ return rc ;
265
+
266
+ count = rc ;
267
+ while (count -- > 0 )
268
+ rpcrdma_recvcq_process_wc (wcs ++ );
269
+ } while (rc == RPCRDMA_POLLSIZE );
270
+ return 0 ;
252
271
}
253
272
254
273
/*
@@ -266,9 +285,10 @@ rpcrdma_recvcq_poll(struct ib_cq *cq)
266
285
static void
267
286
rpcrdma_recvcq_upcall (struct ib_cq * cq , void * cq_context )
268
287
{
288
+ struct rpcrdma_ep * ep = (struct rpcrdma_ep * )cq_context ;
269
289
int rc ;
270
290
271
- rc = rpcrdma_recvcq_poll (cq );
291
+ rc = rpcrdma_recvcq_poll (cq , ep );
272
292
if (rc ) {
273
293
dprintk ("RPC: %s: ib_poll_cq failed: %i\n" ,
274
294
__func__ , rc );
@@ -285,7 +305,7 @@ rpcrdma_recvcq_upcall(struct ib_cq *cq, void *cq_context)
285
305
return ;
286
306
}
287
307
288
- rpcrdma_recvcq_poll (cq );
308
+ rpcrdma_recvcq_poll (cq , ep );
289
309
}
290
310
291
311
#ifdef RPC_DEBUG
@@ -721,7 +741,7 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
721
741
INIT_DELAYED_WORK (& ep -> rep_connect_worker , rpcrdma_connect_worker );
722
742
723
743
sendcq = ib_create_cq (ia -> ri_id -> device , rpcrdma_sendcq_upcall ,
724
- rpcrdma_cq_async_error_upcall , NULL ,
744
+ rpcrdma_cq_async_error_upcall , ep ,
725
745
ep -> rep_attr .cap .max_send_wr + 1 , 0 );
726
746
if (IS_ERR (sendcq )) {
727
747
rc = PTR_ERR (sendcq );
@@ -738,7 +758,7 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
738
758
}
739
759
740
760
recvcq = ib_create_cq (ia -> ri_id -> device , rpcrdma_recvcq_upcall ,
741
- rpcrdma_cq_async_error_upcall , NULL ,
761
+ rpcrdma_cq_async_error_upcall , ep ,
742
762
ep -> rep_attr .cap .max_recv_wr + 1 , 0 );
743
763
if (IS_ERR (recvcq )) {
744
764
rc = PTR_ERR (recvcq );
0 commit comments