Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel.hfa

    r61dd73d rf6660520  
    114114//-----------------------------------------------------------------------------
    115115// I/O
    116 struct __io_data;
     116#if defined(HAVE_LINUX_IO_URING_H)
     117struct io_uring_sq {
     118        // Head and tail of the ring (associated with array)
     119        volatile uint32_t * head;
     120        volatile uint32_t * tail;
     121
     122        // The actual kernel ring which uses head/tail
     123        // indexes into the sqes arrays
     124        uint32_t * array;
     125
     126        // number of entries and mask to go with it
     127        const uint32_t * num;
     128        const uint32_t * mask;
     129
     130        // Submission flags (Not sure what for)
     131        uint32_t * flags;
     132
     133        // number of sqes not submitted (whatever that means)
     134        uint32_t * dropped;
     135
     136        // Like head/tail but not seen by the kernel
     137        volatile uint32_t alloc;
     138        volatile uint32_t ready;
     139
     140        __spinlock_t lock;
     141
     142        // A buffer of sqes (not the actual ring)
     143        struct io_uring_sqe * sqes;
     144
     145        // The location and size of the mmaped area
     146        void * ring_ptr;
     147        size_t ring_sz;
     148
     149        // Statistics
     150        #if !defined(__CFA_NO_STATISTICS__)
     151                struct {
     152                        struct {
     153                                unsigned long long int val;
     154                                unsigned long long int cnt;
     155                        } submit_avg;
     156                } stats;
     157        #endif
     158};
     159
     160struct io_uring_cq {
     161        // Head and tail of the ring
     162        volatile uint32_t * head;
     163        volatile uint32_t * tail;
     164
     165        // number of entries and mask to go with it
     166        const uint32_t * mask;
     167        const uint32_t * num;
     168
     169        // number of cqes not submitted (whatever that means)
     170        uint32_t * overflow;
     171
     172        // the kernel ring
     173        struct io_uring_cqe * cqes;
     174
     175        // The location and size of the mmaped area
     176        void * ring_ptr;
     177        size_t ring_sz;
     178
     179        // Statistics
     180        #if !defined(__CFA_NO_STATISTICS__)
     181                struct {
     182                        struct {
     183                                unsigned long long int val;
     184                                unsigned long long int cnt;
     185                        } completed_avg;
     186                } stats;
     187        #endif
     188};
     189
     190#if defined(__CFA_IO_POLLING_USER__)
     191        struct __io_poller_fast {
     192                struct io_ring * ring;
     193                $thread thrd;
     194        };
     195#endif
     196
     197struct io_ring {
     198        struct io_uring_sq submit_q;
     199        struct io_uring_cq completion_q;
     200        uint32_t flags;
     201        int fd;
     202        semaphore submit;
     203        volatile bool done;
     204        struct {
     205                struct {
     206                        void * stack;
     207                        pthread_t kthrd;
     208                } slow;
     209                #if defined(__CFA_IO_POLLING_USER__)
     210                        __io_poller_fast fast;
     211                        __bin_sem_t sem;
     212                #endif
     213        } poller;
     214};
     215#endif
    117216
    118217//-----------------------------------------------------------------------------
     
    148247        } node;
    149248
    150         struct __io_data * io;
     249        #if defined(HAVE_LINUX_IO_URING_H)
     250                struct io_ring io;
     251        #endif
    151252
    152253        #if !defined(__CFA_NO_STATISTICS__)
Note: See TracChangeset for help on using the changeset viewer.