Skip to content

io_uring: thread cqe->flags through CompletionCb#44667

Draft
aburan28 wants to merge 1 commit intoenvoyproxy:mainfrom
aburan28:multishot-recv/01-cb-flags
Draft

io_uring: thread cqe->flags through CompletionCb#44667
aburan28 wants to merge 1 commit intoenvoyproxy:mainfrom
aburan28:multishot-recv/01-cb-flags

Conversation

@aburan28
Copy link
Copy Markdown

Summary

No-behavior-change refactor in preparation for multishot recv support. CompletionCb gains a uint32_t flags argument carrying the raw cqe->flags value from the kernel. The worker callback ignores it for now.

A follow-up change will introduce a buf-ring + prepareRecvMultishot and start observing:

  • IORING_CQE_F_BUFFER — a buffer was selected from a buf-ring; the buffer ID is in the upper bits.
  • IORING_CQE_F_MORE — the SQE will produce further completions.

Injected completions are defined to always carry flags == 0.

Why split this out

The full multishot-recv change touches the buf-ring lifecycle in IoUringImpl, the read path in IoUringServerSocket, and the proto config. Threading flags through the existing callback is mechanical and easy to review on its own; landing it first lets the rest of the stack be a behavioral change rather than a behavioral + signature change.

What changed

  • envoy/common/io/io_uring.hCompletionCb typedef + doc.
  • source/common/io/io_uring_impl.cc — pass cqe->flags for kernel completions, 0 for injected.
  • source/common/io/io_uring_worker_impl.cc — accept the new arg in the worker lambda (unused for now).
  • test/common/io/io_uring_impl_test.cc, test/common/io/io_uring_worker_impl_test.cc — update test lambdas.

IoUringSocket::on* virtual methods are intentionally unchanged here; only onRead will need flags, in the multishot recv change.

Test plan

  • Existing io_uring unit tests pass on Linux CI.
  • Existing io_uring integration tests pass on Linux CI.

This is a no-behavior-change preparation step for multishot recv. The
``CompletionCb`` callback type now takes a ``uint32_t flags`` argument
that carries the raw ``cqe->flags`` value from the kernel.

For multishot completions a follow-up change will inspect:
* ``IORING_CQE_F_BUFFER`` — a buffer was selected from a buf-ring; the
  buffer ID is encoded in the upper bits.
* ``IORING_CQE_F_MORE`` — the SQE will produce further completions.

The worker callback ignores ``flags`` for now. Injected completions are
defined to always carry ``flags == 0``.

All ``forEveryCompletion`` callers (worker, impl tests) updated.
``IoUringSocket::on*`` virtual methods are intentionally unchanged in
this commit; only ``onRead`` will need flags, in the multishot recv
change.

Signed-off-by: Adam Buran <a.buran28@gmail.com>
Signed-off-by: Adam Buran <aburan28@gmail.com>
@aburan28 aburan28 requested a deployment to external-contributors April 27, 2026 01:57 — with GitHub Actions Waiting
@repokitteh-read-only
Copy link
Copy Markdown

Hi @aburan28, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #44667 was opened by aburan28.

see: more, trace.

@repokitteh-read-only
Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #44667 was opened by aburan28.

see: more, trace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant