source: libcfa/src/concurrency/io/types.hfa @ 4998155

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 4998155 was 4998155, checked in by Thierry Delisle <tdelisle@…>, 4 years ago

I/O now uses onshot semaphore instead of raw park/unpark.
I/O now uses linux/types.h types instead of stdint.h types

  • Property mode set to 100644
File size: 3.1 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2020 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// io/types.hfa --
8//
9// Author           : Thierry Delisle
10// Created On       : Fri Jul 31 16:22:47 2020
11// Last Modified By :
12// Last Modified On :
13// Update Count     :
14//
15
16#pragma once
17
18#if defined(CFA_HAVE_LINUX_IO_URING_H)
19        extern "C" {
20                #include <linux/types.h>
21        }
22
23      #include "bits/locks.hfa"
24
25        //-----------------------------------------------------------------------
26        // Ring Data structure
27      struct __submition_data {
28                // Head and tail of the ring (associated with array)
29                volatile __u32 * head;
30                volatile __u32 * tail;
31                volatile __u32 prev_head;
32
33                // The actual kernel ring which uses head/tail
34                // indexes into the sqes arrays
35                __u32 * array;
36
37                // number of entries and mask to go with it
38                const __u32 * num;
39                const __u32 * mask;
40
41                // Submission flags (Not sure what for)
42                __u32 * flags;
43
44                // number of sqes not submitted (whatever that means)
45                __u32 * dropped;
46
47                // Like head/tail but not seen by the kernel
48                volatile __u32 * ready;
49                __u32 ready_cnt;
50
51                __spinlock_t lock;
52                __spinlock_t release_lock;
53
54                // A buffer of sqes (not the actual ring)
55                struct io_uring_sqe * sqes;
56
57                // The location and size of the mmaped area
58                void * ring_ptr;
59                size_t ring_sz;
60        };
61
62        struct __completion_data {
63                // Head and tail of the ring
64                volatile __u32 * head;
65                volatile __u32 * tail;
66
67                // number of entries and mask to go with it
68                const __u32 * mask;
69                const __u32 * num;
70
71                // number of cqes not submitted (whatever that means)
72                __u32 * overflow;
73
74                // the kernel ring
75                struct io_uring_cqe * cqes;
76
77                // The location and size of the mmaped area
78                void * ring_ptr;
79                size_t ring_sz;
80        };
81
82        struct __io_data {
83                struct __submition_data submit_q;
84                struct __completion_data completion_q;
85                __u32 ring_flags;
86                int fd;
87                bool eager_submits:1;
88                bool poller_submits:1;
89        };
90
91
92        //-----------------------------------------------------------------------
93        // IO user data
94        struct __io_user_data_t {
95                __s32 result;
96                oneshot sem;
97        };
98
99        //-----------------------------------------------------------------------
100        // Misc
101        // Weirdly, some systems that do support io_uring don't actually define these
102        #ifdef __alpha__
103                /*
104                * alpha is the only exception, all other architectures
105                * have common numbers for new system calls.
106                */
107                #ifndef __NR_io_uring_setup
108                        #define __NR_io_uring_setup           535
109                #endif
110                #ifndef __NR_io_uring_enter
111                        #define __NR_io_uring_enter           536
112                #endif
113                #ifndef __NR_io_uring_register
114                        #define __NR_io_uring_register        537
115                #endif
116        #else /* !__alpha__ */
117                #ifndef __NR_io_uring_setup
118                        #define __NR_io_uring_setup           425
119                #endif
120                #ifndef __NR_io_uring_enter
121                        #define __NR_io_uring_enter           426
122                #endif
123                #ifndef __NR_io_uring_register
124                        #define __NR_io_uring_register        427
125                #endif
126        #endif
127
128        struct epoll_event;
129        struct $io_ctx_thread;
130        void __ioctx_register($io_ctx_thread & ctx, struct epoll_event & ev);
131        void __ioctx_prepare_block($io_ctx_thread & ctx, struct epoll_event & ev);
132#endif
Note: See TracBrowser for help on using the repository browser.