-
Notifications
You must be signed in to change notification settings - Fork 489
Open
Description
For Packet processing Use case, I tried the following multishot model - replacing the legacy recvmmsg() based packet processing flow.
For the rate of 5-6 Gbps traffic rate, I hardly see any difference in throughput between io_uring and legacy design.
But the overall CPU utilization is on the higher side with io_uring based implementation. I have added details of the implementatio
Do you have any suggestions on what can be tuned further to bring down the overall CPU utilization and achieve better throughput with io_uring ?
RX Side (socket_uring_rx.c)
io_uring APIs:
io_uring_get_sqe()- Get submission queue entry for new operationsio_uring_prep_recvmsg_multishot()- Prepare multishot receive operationio_uring_sqe_set_data()- Attach user data to SQEio_uring_submit()- Submit operations to kernelio_uring_cqe_get_data()- Retrieve user data from completionio_uring_peek_cqe()- Non-blocking check for completionsio_uring_cqe_seen()- Mark completion as processedio_uring_buf_ring_add()- Add buffer to provided buffer ringio_uring_buf_ring_advance()- Commit buffers to ringio_uring_enable_rings()- Enable ring operations
io_uring Flags:
IOSQE_BUFFER_SELECT- Enable buffer selection from provided buffer ringIORING_CQE_F_MORE- Multishot operation continuesIORING_SETUP_COOP_TASKRUN- Cooperative task runningIORING_SETUP_DEFER_TASKRUN- Defer task workIORING_SETUP_SINGLE_ISSUER- Single-threaded submission optimizationIORING_SETUP_R_DISABLED- Initialize ring in disabled state
Architecture:
- Separate RX/TX rings to avoid contention
- RX: multishot receive with provided buffer ring
- TX: writev operations (sendmsg unsupported for AF_PACKET)
- Both rings use SINGLE_ISSUER + R_DISABLED for single-threaded optimization
RX Path:
- Multishot operations reduce submission overhead
- Provided buffer ring enables zero-copy reception
- Per-socket multishot for multiple sockets
- Automatic multishot resubmission when F_MORE flag absent
- Buffer recycling via buf_ring_add/advance
Metadata
Metadata
Assignees
Labels
No labels