How to reuse io_uring_buf_ring after a failed/incomplete send #1441
Unanswered
stonebrakert6
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
Please let me know if my usage is incorrect or not natural/idiomatic. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
TLDR:
Question: What is the status of
io_uring_buf_ring's head in caseio_uring_prep_send_bundlefails? Can I assume thatheadwill be set to 0 in case of error?Full read:
I am using ring with the following flags
IORING_SETUP_SINGLE_ISSUER | IORING_SETUP_DEFER_TASKRUN, a ring will only be used by a single thread.Use-case:
io_uring_buf_ringbuffer-rings. I use buf_ring to "serialize"senddata.Geta buffer-ring from the above poolio_uring_prep_send_bundle,io_uring_submitetc.Putthe buffer-ring back to the pool for reuse with a differentsend. Because I know thathead == tail?sendwas only partial/fails? e.g I wanted to send 4MB data, but after sending 2 MB, the peer sent RST.In this case if I try to reuse the buffer-ring for some other
sendi.e add buffers to it(which would always be added at tail), it might send some additional garbage(because when I added these buffers,head != tail).Questions:
sendfailureio_uring_buf_ring_headBut that is a system call, is this the best we can do?
Can't the kernel code set
head = 0on failure(I don't know if it already does that or not)? And so we can callio_uring_buf_ring_init(which just sets tail to 0) and we're done?Reference:
1431 and I don't think the following reply by Jens holds good for my use-case?
Beta Was this translation helpful? Give feedback.
All reactions