Line data Source code
1 : #ifndef HEADER_fd_src_discof_reasm_fd_reasm_private_h 2 : #define HEADER_fd_src_discof_reasm_fd_reasm_private_h 3 : 4 : #include "fd_reasm.h" 5 : 6 : #define POOL_NAME pool 7 90 : #define POOL_T fd_reasm_fec_t 8 : #include "../../util/tmpl/fd_pool.c" 9 : 10 : #define MAP_NAME ancestry 11 : #define MAP_ELE_T fd_reasm_fec_t 12 : #define MAP_KEY_T fd_hash_t 13 363 : #define MAP_KEY_EQ(k0,k1) (!memcmp((k0),(k1),sizeof(fd_hash_t))) 14 1341 : #define MAP_KEY_HASH(key,seed) (fd_hash((seed),(key),sizeof(fd_hash_t))) 15 : #include "../../util/tmpl/fd_map_chain.c" 16 : 17 : #define MAP_NAME frontier 18 : #define MAP_ELE_T fd_reasm_fec_t 19 : #define MAP_KEY_T fd_hash_t 20 678 : #define MAP_KEY_EQ(k0,k1) (!memcmp((k0),(k1),sizeof(fd_hash_t))) 21 1563 : #define MAP_KEY_HASH(key,seed) (fd_hash((seed),(key),sizeof(fd_hash_t))) 22 : #include "../../util/tmpl/fd_map_chain.c" 23 : 24 : #define MAP_NAME orphaned 25 : #define MAP_ELE_T fd_reasm_fec_t 26 : #define MAP_KEY_T fd_hash_t 27 66 : #define MAP_KEY_EQ(k0,k1) (!memcmp((k0),(k1),sizeof(fd_hash_t))) 28 888 : #define MAP_KEY_HASH(key,seed) (fd_hash((seed),(key),sizeof(fd_hash_t))) 29 : #include "../../util/tmpl/fd_map_chain.c" 30 : 31 : #define MAP_NAME subtrees 32 : #define MAP_ELE_T fd_reasm_fec_t 33 : #define MAP_KEY_T fd_hash_t 34 81 : #define MAP_KEY_EQ(k0,k1) (!memcmp((k0),(k1),sizeof(fd_hash_t))) 35 864 : #define MAP_KEY_HASH(key,seed) (fd_hash((seed),(key),sizeof(fd_hash_t))) 36 : #include "../../util/tmpl/fd_map_chain.c" 37 : 38 : #define DLIST_NAME subtreel 39 : #define DLIST_ELE_T fd_reasm_fec_t 40 90 : #define DLIST_PREV subtreel.prev 41 210 : #define DLIST_NEXT subtreel.next 42 : #include "../../util/tmpl/fd_dlist.c" 43 : 44 : #define DLIST_NAME out 45 : #define DLIST_ELE_T fd_reasm_fec_t 46 351 : #define DLIST_PREV out.prev 47 573 : #define DLIST_NEXT out.next 48 : #include "../../util/tmpl/fd_dlist.c" 49 : 50 : #define DEQUE_NAME bfs 51 531 : #define DEQUE_T ulong 52 : #include "../../util/tmpl/fd_deque_dynamic.c" 53 : 54 : struct xid { 55 : ulong key; /* 32 msb slot | 32 lsb fec_set_idx. if fec_set_idx is UINT_MAX, then this xid represents the block id for this slot. */ 56 : ulong idx; /* pool idx of first FEC seen. Updated only on confirmation. */ 57 : uint cnt; /* count of FECs with this xid key. If > 1, equivocation occurred on this FEC set */ 58 : }; 59 : typedef struct xid xid_t; 60 : 61 : #define MAP_NAME xid 62 1515 : #define MAP_T xid_t 63 28737 : #define MAP_KEY_NULL ULONG_MAX 64 1719 : #define MAP_KEY_INVAL(k) ((k)==MAP_KEY_NULL) 65 : #define MAP_MEMOIZE 0 66 : #include "../../util/tmpl/fd_map_dynamic.c" 67 : 68 : struct __attribute__((aligned(128UL))) fd_reasm { 69 : ulong slot0; /* special initialization slot. chains first FEC */ 70 : ulong root; /* pool idx of the root FEC set */ 71 : ulong pool_gaddr; /* gaddr of the pool of FEC nodes backing the above maps / tree */ 72 : ulong wksp_gaddr; /* gaddr of this reasm struct within the workspace */ 73 : ancestry_t * ancestry; /* map of mr->fec. non-leaves of the connected tree */ 74 : frontier_t * frontier; /* map of mr->fec. leaves of the connected tree */ 75 : orphaned_t * orphaned; /* map of mr->fec. non-roots of the orphaned subtrees */ 76 : subtrees_t * subtrees; /* map of mr->fec. roots of the orphaned subtrees */ 77 : subtreel_t _subtrlf[1]; /* internal dlist of the elements in subtrees in no particular order */ 78 : subtreel_t * subtreel; /* the join to the dlist */ 79 : 80 : out_t _out[1]; /* delivery queue(dlist) of elements to output */ 81 : out_t * out; /* the join to the dlist */ 82 : 83 : ulong * bfs; /* internal queue of pool idxs for BFS */ 84 : xid_t * xid; /* map of (slot, fec_set_idx)->mr */ 85 : }; 86 : 87 : FD_FN_PURE static inline fd_wksp_t * 88 2352 : wksp( fd_reasm_t const * reasm ) { 89 2352 : return (fd_wksp_t *)( (ulong)reasm - reasm->wksp_gaddr ); 90 2352 : } 91 : 92 : static inline fd_reasm_fec_t * 93 2256 : reasm_pool( fd_reasm_t * reasm ) { 94 2256 : return (fd_reasm_fec_t *)fd_wksp_laddr_fast( wksp( reasm ), reasm->pool_gaddr ); 95 2256 : } 96 : 97 : static inline fd_reasm_fec_t const * 98 96 : reasm_pool_const( fd_reasm_t const * reasm ) { 99 96 : return (fd_reasm_fec_t const *)fd_wksp_laddr_fast( wksp( reasm ), reasm->pool_gaddr ); 100 96 : } 101 : 102 : #endif /* HEADER_fd_src_discof_reasm_fd_reasm_private_h */