Line data Source code
1 : #ifndef HEADER_fd_src_waltz_aio_fd_aio_tango_h 2 : #define HEADER_fd_src_waltz_aio_fd_aio_tango_h 3 : 4 : #include "fd_aio.h" 5 : #include "../../tango/fd_tango.h" 6 : 7 : /* fd_aio_tango_tx_t provides an API to submit frags to an mcache/dcache 8 : pair via fd_aio_send. 9 : 10 : Assumes dcache is compactly stored with burst==1. 11 : Assumes mcache and dcache have same depth. 12 : Assumes dcache has enough room for frags with max size 'mtu'. */ 13 : 14 : struct fd_aio_tango_tx { 15 : fd_aio_t aio; 16 : fd_frag_meta_t * mcache; 17 : void * dcache; 18 : void * base; 19 : ulong chunk0; 20 : ulong wmark; 21 : ulong depth; 22 : ulong mtu; 23 : ulong orig; 24 : ulong sig; 25 : ulong chunk; 26 : ulong seq; 27 : }; 28 : 29 : typedef struct fd_aio_tango_tx fd_aio_tango_tx_t; 30 : 31 : FD_PROTOTYPES_BEGIN 32 : 33 : fd_aio_tango_tx_t * 34 : fd_aio_tango_tx_new( fd_aio_tango_tx_t * self, 35 : fd_frag_meta_t * mcache, 36 : void * dcache, 37 : void * base, 38 : ulong mtu, 39 : ulong orig, 40 : ulong sig ); 41 : 42 : void * 43 : fd_aio_tango_tx_delete( fd_aio_tango_tx_t * self ); 44 : 45 : FD_FN_CONST static inline fd_aio_t const * 46 0 : fd_aio_tango_tx_aio( fd_aio_tango_tx_t const * self ) { 47 0 : return &self->aio; 48 0 : } 49 : 50 : FD_PROTOTYPES_END 51 : 52 : 53 : /* fd_aio_tango_rx_t provides an API to receive frags from an mcache. 54 : Does not support fragmentation. Does not backpressure (frags are 55 : skipped if fd_aio is too slow). Frag pointers provided to the aio 56 : receiver may be overrun during the fd_aio_send callback. Mainly 57 : intended for testing and does not support high performance. */ 58 : 59 : struct fd_aio_tango_rx { 60 : fd_frag_meta_t const * mcache; 61 : ulong depth; 62 : void * base; 63 : ulong seq; 64 : fd_aio_t const * aio; 65 : }; 66 : 67 : typedef struct fd_aio_tango_rx fd_aio_tango_rx_t; 68 : 69 : FD_PROTOTYPES_BEGIN 70 : 71 : fd_aio_tango_rx_t * 72 : fd_aio_tango_rx_new( fd_aio_tango_rx_t * self, 73 : fd_aio_t const * aio, 74 : fd_frag_meta_t const * mcache, 75 : ulong seq0, 76 : void * base ); 77 : 78 : void * 79 : fd_aio_tango_rx_delete( fd_aio_tango_rx_t * self ); 80 : 81 : void 82 : fd_aio_tango_rx_poll( fd_aio_tango_rx_t * self ); 83 : 84 : FD_PROTOTYPES_END 85 : 86 : #endif /* HEADER_fd_src_waltz_aio_fd_aio_tango_h */