Skip to content

Commit 926e1b1

Browse files
committed
examples/zcrx: handle CQ overflow
The request can get terminated if the CQ becomes full, handle it by reissuing the request. Signed-off-by: Pavel Begunkov <[email protected]>
1 parent ddd2ab7 commit 926e1b1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

examples/zcrx.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,19 @@ static void return_buffer(struct io_uring_zcrx_rq *rq_ring,
332332

333333
static void process_recvzc_error(struct io_uring *ring, int ret)
334334
{
335+
if (ret == -ENOSPC) {
336+
size_t left = 0;
337+
338+
if (cfg_size) {
339+
left = cfg_size - received;
340+
if (left == 0)
341+
t_error(1, 0, "ENOSPC for a finished request");
342+
}
343+
344+
add_recvzc(ring, connfd, left);
345+
return;
346+
}
347+
335348
if (ret != 0)
336349
t_error(1, 0, "invalid final recvzc ret %i", ret);
337350
if (cfg_size && received != cfg_size)

0 commit comments

Comments
 (0)