// // Cforall Version 1.0.0 Copyright (C) 2020 University of Waterloo // // The contents of this file are covered under the licence agreement in the // file "LICENCE" distributed with Cforall. // // io/types.hfa -- // // Author : Thierry Delisle // Created On : Fri Jul 31 16:22:47 2020 // Last Modified By : // Last Modified On : // Update Count : // #pragma once #if defined(CFA_HAVE_LINUX_IO_URING_H) #include "bits/locks.hfa" //----------------------------------------------------------------------- // Ring Data structure struct __submition_data { // Head and tail of the ring (associated with array) volatile uint32_t * head; volatile uint32_t * tail; volatile uint32_t prev_head; // The actual kernel ring which uses head/tail // indexes into the sqes arrays uint32_t * array; // number of entries and mask to go with it const uint32_t * num; const uint32_t * mask; // Submission flags (Not sure what for) uint32_t * flags; // number of sqes not submitted (whatever that means) uint32_t * dropped; // Like head/tail but not seen by the kernel volatile uint32_t * ready; uint32_t ready_cnt; __spinlock_t lock; __spinlock_t release_lock; // A buffer of sqes (not the actual ring) struct io_uring_sqe * sqes; // The location and size of the mmaped area void * ring_ptr; size_t ring_sz; }; struct __completion_data { // Head and tail of the ring volatile uint32_t * head; volatile uint32_t * tail; // number of entries and mask to go with it const uint32_t * mask; const uint32_t * num; // number of cqes not submitted (whatever that means) uint32_t * overflow; // the kernel ring struct io_uring_cqe * cqes; // The location and size of the mmaped area void * ring_ptr; size_t ring_sz; }; struct __io_data { struct __submition_data submit_q; struct __completion_data completion_q; uint32_t ring_flags; int fd; bool eager_submits:1; bool poller_submits:1; }; //----------------------------------------------------------------------- // IO user data struct __io_user_data_t { int32_t result; $thread * thrd; }; //----------------------------------------------------------------------- // Misc // Weirdly, some systems that do support io_uring don't actually define these #ifdef __alpha__ /* * alpha is the only exception, all other architectures * have common numbers for new system calls. */ #ifndef __NR_io_uring_setup #define __NR_io_uring_setup 535 #endif #ifndef __NR_io_uring_enter #define __NR_io_uring_enter 536 #endif #ifndef __NR_io_uring_register #define __NR_io_uring_register 537 #endif #else /* !__alpha__ */ #ifndef __NR_io_uring_setup #define __NR_io_uring_setup 425 #endif #ifndef __NR_io_uring_enter #define __NR_io_uring_enter 426 #endif #ifndef __NR_io_uring_register #define __NR_io_uring_register 427 #endif #endif struct epoll_event; struct $io_ctx_thread; void __ioctx_register($io_ctx_thread & ctx, struct epoll_event & ev); void __ioctx_prepare_block($io_ctx_thread & ctx, struct epoll_event & ev); #endif