Skip to content

io_uring: thread cqe->flags through CompletionCb#44667

Open
aburan28 wants to merge 1 commit into
envoyproxy:mainfrom
aburan28:multishot-recv/01-cb-flags
Open

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

Conversation

@aburan28
Copy link
Copy Markdown

@aburan28 aburan28 commented Apr 27, 2026

Commit Message:
io_uring: thread cqe->flags through CompletionCb

No-behavior-change refactor in preparation for multishot recv. CompletionCb
gains a uint32_t flags argument carrying the raw cqe->flags value from the
kernel. Kernel completions forward cqe->flags; injected completions pass 0.
The worker callback ignores it for now. A follow-up will introduce a buf-ring
plus prepareRecvMultishot and start observing IORING_CQE_F_BUFFER and
IORING_CQE_F_MORE.

Additional Description:
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.

Files touched:

  • 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.

AI usage disclosure: Portions of the code and/or PR description were drafted
with the assistance of Claude (Anthropic). I reviewed and understand all
submitted code.

Risk Level: Low
(No behavior change; mechanical signature change to an internal callback.
Worker still discards the new argument.)

Testing: Existing io_uring unit and integration tests on Linux CI.

Docs Changes: N/A

Release Notes: N/A (internal refactor, no user-visible or extension-developer-
visible change.)

Platform Specific Features: N/A. io_uring is Linux-only and the affected code
already lives behind the existing io_uring build gating; this PR does not
change platform support or introduce new platform-specific surface.

Runtime guard: N/A (no behavioral change).

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.

@zuercher
Copy link
Copy Markdown
Member

zuercher commented May 5, 2026

Please add the fields from the pull request template to your PR description and review CONTRIBUTING.md, especially the section on AI use.

@zuercher
Copy link
Copy Markdown
Member

zuercher commented May 5, 2026

/wait

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants