Ignore:
Timestamp:
Apr 14, 2020, 11:53:25 AM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
34d0a28
Parents:
7df014f
Message:

Implemented basic non-blocking io

File:
1 edited

Legend:

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

    r7df014f r2d8f7b0  
    115115#if defined(HAVE_LINUX_IO_URING_H)
    116116struct io_uring_sq {
    117         uint32_t * head;
    118         uint32_t * tail;
    119         uint32_t * mask;
    120         uint32_t * entries;
    121         uint32_t * flags;
    122         uint32_t * dropped;
    123         uint32_t * array;
    124         struct io_uring_sqe * sqes;
    125 
    126         uint32_t sqe_head;
    127         uint32_t sqe_tail;
    128 
    129         size_t ring_sz;
    130         void * ring_ptr;
    131 };
    132 
    133 struct io_uring_cq {
     117        // Head and tail of the ring (associated with array)
    134118        volatile uint32_t * head;
    135119        volatile uint32_t * tail;
    136         uint32_t * mask;
    137         struct io_uring_cqe * entries;
     120
     121        // The actual kernel ring which uses head/tail
     122        // indexes into the sqes arrays
     123        uint32_t * array;
     124
     125        // number of entries and mask to go with it
     126        const uint32_t * num;
     127        const uint32_t * mask;
     128
     129        // Submission flags (Not sure what for)
     130        uint32_t * flags;
     131
     132        // number of sqes not submitted (whatever that means)
     133        uint32_t * dropped;
     134
     135        // Like head/tail but not seen by the kernel
     136        volatile uint32_t alloc;
     137
     138        __spinlock_t lock;
     139
     140        // A buffer of sqes (not the actual ring)
     141        struct io_uring_sqe * sqes;
     142
     143        // The location and size of the mmaped area
     144        void * ring_ptr;
     145        size_t ring_sz;
     146};
     147
     148struct io_uring_cq {
     149        // Head and tail of the ring
     150        volatile uint32_t * head;
     151        volatile uint32_t * tail;
     152
     153        // number of entries and mask to go with it
     154        const uint32_t * mask;
     155        const uint32_t * num;
     156
     157        // number of cqes not submitted (whatever that means)
    138158        uint32_t * overflow;
     159
     160        // the kernel ring
    139161        struct io_uring_cqe * cqes;
    140162
     163        // The location and size of the mmaped area
     164        void * ring_ptr;
    141165        size_t ring_sz;
    142         void * ring_ptr;
    143166};
    144167
     
    151174        void * stack;
    152175        volatile bool done;
     176        semaphore submit;
    153177};
    154178#endif
Note: See TracChangeset for help on using the changeset viewer.