Line data Source code
1 : #ifndef HEADER_fd_src_disco_stem_fd_stem_h 2 : #define HEADER_fd_src_disco_stem_fd_stem_h 3 : 4 : #include "../fd_disco_base.h" 5 : 6 : struct fd_stem_context { 7 : fd_frag_meta_t ** mcaches; 8 : ulong * seqs; 9 : ulong * depths; 10 : 11 : ulong * cr_avail; 12 : ulong cr_decrement_amount; 13 : }; 14 : 15 : typedef struct fd_stem_context fd_stem_context_t; 16 : 17 : struct __attribute__((aligned(64))) fd_stem_tile_in { 18 : fd_frag_meta_t const * mcache; /* local join to this in's mcache */ 19 : uint depth; /* == fd_mcache_depth( mcache ), depth of this in's cache (const) */ 20 : uint idx; /* index of this in in the list of providers, [0, in_cnt) */ 21 : ulong seq; /* sequence number of next frag expected from the upstream producer, 22 : updated when frag from this in is published */ 23 : fd_frag_meta_t const * mline; /* == mcache + fd_mcache_line_idx( seq, depth ), location to poll next */ 24 : ulong * fseq; /* local join to the fseq used to return flow control credits to the in */ 25 : uint accum[6]; /* local diagnostic accumulators. These are drained during in housekeeping. */ 26 : /* Assumes FD_FSEQ_DIAG_{PUB_CNT,PUB_SZ,FILT_CNT,FILT_SZ,OVRNP_CNT,OVRNP_FRAG_CNT} are 0:5 */ 27 : }; 28 : 29 : typedef struct fd_stem_tile_in fd_stem_tile_in_t; 30 : 31 : static inline void 32 : fd_stem_publish( fd_stem_context_t * stem, 33 : ulong out_idx, 34 : ulong sig, 35 : ulong chunk, 36 : ulong sz, 37 : ulong ctl, 38 : ulong tsorig, 39 0 : ulong tspub ) { 40 0 : ulong * seqp = &stem->seqs[ out_idx ]; 41 0 : ulong seq = *seqp; 42 0 : fd_mcache_publish( stem->mcaches[ out_idx ], stem->depths[ out_idx ], seq, sig, chunk, sz, ctl, tsorig, tspub ); 43 0 : *stem->cr_avail -= stem->cr_decrement_amount; 44 0 : *seqp = fd_seq_inc( seq, 1UL ); 45 0 : } 46 : 47 : static inline ulong 48 : fd_stem_advance( fd_stem_context_t * stem, 49 0 : ulong out_idx ) { 50 0 : ulong * seqp = &stem->seqs[ out_idx ]; 51 0 : ulong seq = *seqp; 52 0 : *stem->cr_avail -= stem->cr_decrement_amount; 53 0 : *seqp = fd_seq_inc( seq, 1UL ); 54 0 : return seq; 55 0 : } 56 : 57 : #endif /* HEADER_fd_src_disco_stem_fd_stem_h */