25inline bool check_cqe32([[maybe_unused]] io_uring_cqe *cqe) {
26 auto *ring = detail::Context::current().ring();
27 assert(ring !=
nullptr);
28 auto ring_flags = ring->ring()->flags;
29 if (ring_flags & IORING_SETUP_CQE32) {
32#if !IO_URING_CHECK_VERSION(2, 13)
33 if (ring_flags & IORING_SETUP_CQE_MIXED) {
34 return cqe->flags & IORING_CQE_F_32;
50 using ReturnType = int32_t;
52 void handle_cqe(io_uring_cqe *cqe) { res_ = cqe->res; }
54 ReturnType extract_result() {
return res_; }
57 int32_t res_ = -ENOTRECOVERABLE;
67template <BufferRingLike Br>
class SelectBufferCQEHandler {
69 using ReturnType = std::pair<int, typename Br::ReturnType>;
71 SelectBufferCQEHandler(Br *buffers) : buffers_(buffers) {}
73 void handle_cqe(io_uring_cqe *cqe) {
78 ReturnType extract_result() {
79 return std::make_pair(res_, buffers_->handle_finish(res_, flags_));
83 int32_t res_ = -ENOTRECOVERABLE;
115 void handle_cqe(io_uring_cqe *cqe) {
116 assert(detail::check_cqe32(cqe) &&
117 "Expected big CQE for NVMe passthrough");
118 result_.status = cqe->res;
119 result_.result = cqe->big_cqe[0];
122 ReturnType extract_result() {
return result_; }
128#if !IO_URING_CHECK_VERSION(2, 12)
166 void handle_cqe(io_uring_cqe *cqe) {
167 assert(detail::check_cqe32(cqe) &&
168 "Expected big CQE for TX timestamp operations");
169 result_.tskey = cqe->res;
171 static_cast<int>(cqe->flags >> IORING_TIMESTAMP_TYPE_SHIFT);
172 result_.ts = *
reinterpret_cast<io_timespec *
>(cqe + 1);
173 result_.hwts = cqe->flags & IORING_CQE_F_TSTAMP_HW;
176 ReturnType extract_result() {
return result_; }
A CQE handler for NVMe passthrough commands that extracts the status and result from the CQE.
A simple CQE handler that extracts the result from the CQE without any additional processing.
A CQE handler for TX timestamp operations that extracts timestamp information from the CQE.
The main namespace for the Condy library.
Wrapper classes for liburing interfaces.
Result for NVMe passthrough commands, containing the status and result of the command.
uint64_t result
Result of this NVMe command, is the value of cqe->big_cqe[0] for the corresponding CQE.
int status
Status of this NVMe command, is the value of cqe->res for the corresponding CQE.
Result for TX timestamp operations, containing timestamp information from the socket error queue.
int tstype
The timestamp type, could be SCM_TSTAMP_SND, SCM_TSTAMP_SCHED, SCM_TSTAMP_ACK, etc.
io_timespec ts
The timestamp value.
int tskey
The timestamp key if successful, which is the value of cqe->res for the corresponding CQE.
bool hwts
Whether this timestamp is a hardware timestamp.