Skip to content

Commit e83ce8c

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 <asml.silence@gmail.com>
1 parent 97effc3 commit e83ce8c

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

examples/zcrx.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,19 @@ static void return_buffer(struct io_uring_zcrx_rq *rq_ring,
353353
static void process_recvzc_error(struct io_uring *ring, struct zc_conn *conn,
354354
int ret)
355355
{
356+
if (ret == -ENOSPC) {
357+
size_t left = 0;
358+
359+
if (cfg_size) {
360+
left = cfg_size - received;
361+
if (left == 0)
362+
t_error(1, 0, "ENOSPC for a finished request");
363+
}
364+
365+
add_recvzc(ring, connfd, left);
366+
return;
367+
}
368+
356369
if (ret != 0)
357370
t_error(1, 0, "invalid final recvzc ret %i", ret);
358371
if (cfg_size && conn->received != cfg_size)

0 commit comments

Comments
 (0)