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)
noexcept { res_ = cqe->res; }
54 ReturnType extract_result()
noexcept {
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)
noexcept {
74 result_ = std::make_pair(cqe->res, buffers_->handle_finish(cqe));
77 ReturnType extract_result()
noexcept {
return std::move(result_); }
80 ReturnType result_ = {-ENOTRECOVERABLE,
typename Br::ReturnType()};
111 void handle_cqe(io_uring_cqe *cqe)
noexcept {
112 assert(detail::check_cqe32(cqe) &&
113 "Expected big CQE for NVMe passthrough");
114 result_.status = cqe->res;
115 result_.result = cqe->big_cqe[0];
118 ReturnType extract_result()
noexcept {
return result_; }
124#if !IO_URING_CHECK_VERSION(2, 12)
162 void handle_cqe(io_uring_cqe *cqe)
noexcept {
163 assert(detail::check_cqe32(cqe) &&
164 "Expected big CQE for TX timestamp operations");
165 result_.tskey = cqe->res;
167 static_cast<int>(cqe->flags >> IORING_TIMESTAMP_TYPE_SHIFT);
168 result_.ts = *
reinterpret_cast<io_timespec *
>(cqe + 1);
169 result_.hwts = cqe->flags & IORING_CQE_F_TSTAMP_HW;
172 ReturnType extract_result()
noexcept {
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.